计划:
#include<iostream>
using namespace std;
int main()
{
int a[5] = {4,5,9,1,2};
int i,j,temp;
cout<<"Assending sorting: "<<endl;
for(i=1; i<5; i++)
{
temp = a[i];
if(a[i]<a[i-1])
{
temp = a[i-1];
a[i-1] = a[i];
a[i] = temp;
}
}
}错误:
error LNK2005: _main already defined in assen test.obj
C:\Program Files\Microsoft Visual Studio 10.0\my Project\sorting\binary
search\main.obj
error LNK1169: one or more multiply defined symbols found
C:\Program Files\Microsoft Visual Studio 10.0\my Project\sorting\Debug\binary
search.exe从我的观点来看,程序应该工作正常,但我不明白链接器错误。有人能帮我吗?
谢谢
发布于 2011-05-20 08:48:53
据我所见,您似乎已经在代码中声明了两个名称为main的函数,可能在另一个.c/..cpp文件中。
https://stackoverflow.com/questions/6069458
复制相似问题