I am a new user to Netbeans and Mac OS both. I have a very simple C++ code
#include <iostream>
#include <string>
using namespace std;
int main()
{
int i,count=0;
char c;
cin>>c;
for (i=0;i<10;i++)
{
count=count+1;
}
cout<<"count="<<count;
}
I got the error below:
> "/usr开发者_如何学运维/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-MacOSX/azadeh
mkdir -p dist/Debug/GNU-MacOSX
g++ -o dist/Debug/GNU-MacOSX/azadeh build/Debug/GNU-MacOSX/string.o build/Debug/GNU-MacOSX/string-number.o
ld: duplicate symbol _main in build/Debug/GNU-MacOSX/string-number.o and build/Debug/GNU-MacOSX/string.o
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-MacOSX/azadeh] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
>BUILD FAILED (exit value 2, total time: 60ms)
Does have anybody any idea how to solve this?
Thanks. Ehsan
You're linking two files together, and they both have main
function defined. You need to remove one of those functions.
精彩评论