编辑无错,连接有错误
小猴饲养员 2006-05-20 07:12:24 下面的程序编辑时没错误,连接时出现
“--------------------Configuration: pr10002 - Win32 Debug--------------------
Linking...
001.obj : error LNK2005: _main already defined in pr10002.obj
LIBCD.lib(strcat.obj) : error LNK2005: _strcpy already defined in 001.obj
Debug/pr10002.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
pr10002.exe - 3 error(s), 0 warning(s)”
请问这是为什么?程序如下:
#include<iostream>
#include<cstring>
char *strcpy(char*s1, const char* s2)
{
char *s=s1;
while((*s1++=*s2++)!='\0');
return 0;
}
int main()
{
char rcv[25];
const char snd[]="Hello,Dolly";
strcpy(rcv,snd);
std::cout<<rcv;
return 0;
}