Cygwin 在netbeans中生成失败(退出值2,总时间:947ms)
示例代码Cygwin 在netbeans中生成失败(退出值2,总时间:947ms),cygwin,netbeans-8.1,Cygwin,Netbeans 8.1,示例代码 我不确定出了什么问题,但无法修复此问题,并检查了所有可用的解决方案,但仍然存在。根据发生错误的命令行,您正在链接两个对象文件:main.o和newfile.o。c中的代码是一个控制台程序。IDE中是否有标志指定可执行目标是Windows或GUI应用程序而不是控制台程序?通常,IDE将为GUI应用程序(在main.o中)提供main()函数,您在代码中提供WinMain()(或类似名称)函数,而对于控制台程序,您提供main()函数。感谢您的评论,它帮助我清除了错误!!! #includ
我不确定出了什么问题,但无法修复此问题,并检查了所有可用的解决方案,但仍然存在。根据发生错误的命令行,您正在链接两个对象文件:main.o和newfile.o。c中的代码是一个控制台程序。IDE中是否有标志指定可执行目标是Windows或GUI应用程序而不是控制台程序?通常,IDE将为GUI应用程序(在main.o中)提供
main()
函数,您在代码中提供WinMain()
(或类似名称)函数,而对于控制台程序,您提供main()
函数。感谢您的评论,它帮助我清除了错误!!!
#include <cstdlib>
#include <iostream>
using namespace std;
/*
*
*/
int main() {
cout<<"hello";
return 0;
}
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/cppapplication_1.exe
make[2]: Entering directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
mkdir -p dist/Debug/Cygwin-Windows
g++ -o dist/Debug/Cygwin-Windows/cppapplication_1 build/Debug/Cygwin-Windows/main.o build/Debug/Cygwin-Windows/newfile.o
build/Debug/Cygwin-Windows/newfile.o: In function `main':
/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/newfile.cpp:4: multiple definition of `main'
build/Debug/Cygwin-Windows/main.o:/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1/main.cpp:16: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [nbproject/Makefile-Debug.mk:64: dist/Debug/Cygwin-Windows/cppapplication_1.exe] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make[1]: *** [nbproject/Makefile-Debug.mk:60: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/dell/Desktop/coding/CppApplication_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 802ms)