小编Rup*_*ind的帖子

编译netbeans中的cpp代码会产生错误,如何解决呢?

我使用netbeans与MinGW和MYSY make/debugger,但当我编译一个基本的cpp代码并运行它产生两个erorrs

这是运行的代码和输出![alt text] [1]框

#include <iostream>
void main()
{
  cout << "Hello World!" << endl;  
  cout << "Welcome to C++ Programming" << endl;
}
Run Code Online (Sandbox Code Playgroud)

输出是

/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 …
Run Code Online (Sandbox Code Playgroud)

c++ netbeans mingw

0
推荐指数
1
解决办法
1774
查看次数

标签 统计

c++ ×1

mingw ×1

netbeans ×1