Compiling...
file1.cpp
file2.cpp
Linking...
file2.obj : error LNK2005: "double __cdecl add(double,double)" (?add@@YANNN@Z) already defined in file1.obj
Debug oid.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.
void.exe - 1 error(s), 0 warning(s)
--------file1.cpp--
double add(double a, double b)
{
return a + b;
}
-----file2.cpp
#include "file1.cpp"
#include
void main()
{
double a,b;
double e,f;
a = 3;
b = 2;
e = add(a,2);
f = add(b+1,2);
cout<