VC出现error LNK2005 错误应该怎么办??
--------------------Configuration:abc-Win32Debug--------------------Linking...main.ob...
--------------------Configuration: abc - Win32 Debug--------------------
Linking...
main.obj : error LNK2005: "double __cdecl AVE(double,double,double)" (?AVE@@YANNNN@Z) already defined in abc.obj
Debug/abc.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
abc.exe - 1 error(s), 0 warning(s)
---main.cpp---
#include <iomanip.h>
#include "abc.cpp"
void main()
{
double a,b,c;
double averageValue;
a=2;b=3;c=4;
averageValue=AVE(a,b,c);
cout<<"averageValue:"<<averageValue<<endl;
averageValue=AVE(a,b+1,c+2);
cout<<"averageValue:"<<averageValue<<endl;
}
---abc.cpp---
double AVE(double x,double y,double z)
{
return (x+y+z)/3;
} 展开
Linking...
main.obj : error LNK2005: "double __cdecl AVE(double,double,double)" (?AVE@@YANNNN@Z) already defined in abc.obj
Debug/abc.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
abc.exe - 1 error(s), 0 warning(s)
---main.cpp---
#include <iomanip.h>
#include "abc.cpp"
void main()
{
double a,b,c;
double averageValue;
a=2;b=3;c=4;
averageValue=AVE(a,b,c);
cout<<"averageValue:"<<averageValue<<endl;
averageValue=AVE(a,b+1,c+2);
cout<<"averageValue:"<<averageValue<<endl;
}
---abc.cpp---
double AVE(double x,double y,double z)
{
return (x+y+z)/3;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询