xt3-10.obj : error LNK2005: _main already defined in xt3-9.obj
我在vc6.0里面打开文件xt3-9.cpp
#include <iostream.h>
void main()
{
int i=0;
int a=0;
do{
if(i%2==0)
a++;
i++;
}while(i<10);
cout<<"a="<<a<<endl;
}
运行之后再打开文件xt3-10
#include <iostream.h>
int add(int x,int y);
void main()
{
int a,b;
float c;
a=1;
b=2;
c=add(a,b);
cout<<c<<endl;
}
int add(int s,int y)
{
return s+y;
}
运行时就会出现“d:\c++\debug\xt3-9.exe this file does not exit.Do you want to build it?”
为什么不是建立d:\c++\debug\xt3-10.exe呢?而且点击“是”就会出现
“Linking...
xt3-10.obj : error LNK2005: _main already defined in xt3-9.obj
Debug/xt3-9.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.”
哪位好心人能给我指点一下?我抱歉我刚注册没有分能给大家。