好奇怪阿.一段代码..编译cpp是没问题的
构造.exe就出现4个错误..
WHY阿..还没遇到这种鬼事情
我用VC6
各位高手有时间来T俺一脚阿代码如下#include<iostream.h>
struct complex
{
double real;
double imaginary;
};
void main(void)
{
int m,n;
double x,y;
complex c1,c2,c3;
int add(int m, int n);
double add(double x,double y);
complex add(complex c1,complex c2);
cout<<"Enter two integer:";
cin>>m>>n;
cout<<"integer"<<m<<"+"<<n<<"="<<add(m,n)<<endl;
cout<<"Enter two real number:";
cin>>x>>y;
cout<<"real number"<<x<<'+'<<y<<"= "<<add(x,y)<<endl;
cout<<"Enter the first complex number:";
cin>>c1.real>>c1.imaginary;
cout<<"Enter the second complex number:";
cin>>c2.real>>c2.imaginary;
c3=add(c1,c2);
cout<<"complex number("<<c1.real<<','<<c1.imaginary<<")+("<<c2.real<<','<<c2.imaginary<<")=("<<c3.real<<','<<c3.imaginary<<")\n";
}错误如下
--------------------Configuration: index - Win32 Debug--------------------
Linking...
indexx.obj : error LNK2001: unresolved external symbol "struct complex __cdecl add(struct complex,struct complex)" (?add@@YA?AUcomplex@@U1@0@Z)
indexx.obj : error LNK2001: unresolved external symbol "double __cdecl add(double,double)" (?add@@YANNN@Z)
indexx.obj : error LNK2001: unresolved external symbol "int __cdecl add(int,int)" (?add@@YAHHH@Z)
Debug/index.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.index.exe - 4 error(s), 0 warning(s)