我使用与MinGW和MYSY化妆/调试器,但在NetBeans当我编译中有一个基本的cpp代码,并运行它,它产生两个erorrs在netbeans中编译cpp代码会产生错误,该如何解决?
这拼命地跑的代码,并输出![ALT文本] [1]框
#include <iostream>
void main()
{
cout << "Hello World!" << endl;
cout << "Welcome to C++ Programming" << endl;
}
输出
/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/d/Users/Home/Documents/NetBeansProjects/newApp'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/newapp.exe
make[2]: Entering directory `/d/Users/Home/Documents/NetBeansProjects/newApp'
mkdir -p dist/Debug/MinGW-Windows
g++.exe -o dist/Debug/MinGW-Windows/newapp build/Debug/MinGW-Windows/newmain.o build/Debug/MinGW-Windows/newfile.o build/Debug/MinGW-Windows/main.o
build/Debug/MinGW-Windows/newfile.o: In function `main':
D:/Users/Home/Documents/NetBeansProjects/newApp/newfile.cpp:5: multiple definition of `main'
build/Debug/MinGW-Windows/newmain.o:D:/Users/Home/Documents/NetBeansProjects/newApp/newmain.c:15: first defined here
build/Debug/MinGW-Windows/main.o: In function `main':
D:/Users/Home/Documents/NetBeansProjects/newApp/main.cpp:13: multiple definition of `main'
build/Debug/MinGW-Windows/newmain.o:D:/Users/Home/Documents/NetBeansProjects/newApp/newmain.c:15: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/newapp.exe] Error 1
make[2]: Leaving directory `/d/Users/Home/Documents/NetBeansProjects/newApp'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/d/Users/Home/Documents/NetBeansProjects/newApp'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
我怎样才能解决这个问题?
你有没有至少尝试'使用std :: cout;使用std :: endl;'? – 2010-05-26 03:45:45