首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

C++编译时提示异常,初学者求高手帮忙解决一上…

2012-08-08 
C++编译时提示错误,菜鸟求高手帮忙解决一下……//file header.h#includeiostream#includecstddefusing n

C++编译时提示错误,菜鸟求高手帮忙解决一下……
//file header.h
#include<iostream>
#include<cstddef>

using namespace std;

class FourPointSeven
{
public:
int program1();
};

class FourPointEight
{
public:
int program1();
};



//file 4.8.cpp
#include "header.h"

int FourPointEight::program1()
{
bool b=true;
int ia[]={1,2,3,4,5,6,7,8,9,0};
int ib[10];
for(int x=0;x!=10;++x)
{
cout<<"请输入第"<<x+1<<"个数据:"<<endl;
cin>>ib[0];
}

for(int x=0;x!=10;++x)
{
if(ia[x]!=ib[x])
{
b=false;
break;
}
}
if(b==true)
{
cout<<"数组相等"<<endl;
}
else
{
cout<<"数组不相等"<<endl;
}
return 0;
}


//flie main.cpp

#include"header.h"

int main()
{
char sel;
cout<<"其出入程序编号:"<<endl;
cin>>sel;
switch(sel)
{
case 'a': 
FourPointEight FPE;
FPE.program1();
break;

}
return 0;
}



编译时提示错误

1>main.obj : error LNK2019: 无法解析的外部符号 "public: int __thiscall FourPointEight::program1(void)" (?program1@FourPointEight@@QAEHXZ),该符号在函数 _main 中被引用
1>D:\My Documents\Visual Studio 2010\Projects\Primer 4\Debug\Primer 4.exe : fatal error LNK1120: 1 个无法解析的外部命令


希望大家 帮忙解决一下啊……

[解决办法]
编译连接的问题,你是不是没有把header.h,8.4.cpp也加到main.cpp的工程文件里

用VC6.0编译通过
[解决办法]
兄弟,你没建立工程吧,我的怎通过了
[解决办法]
大哥,给分啊

热点排行