[英]netbeans c program build fail with tdm-gcc msys
i have recently started to use netbeans to program in c. 我最近开始使用netbeans在c中进行编程。 i usually use codeblocks.
我通常使用代码块。 i have installed tdm-gcc and msys for this purpose.
我已经为此目的安装了tdm-gcc和msys。
the programs are getting compiled successfully. 程序正在成功编译。 but on execution, it shows build failed(exit value 2).
但是在执行时,它显示生成失败(退出值2)。
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/f/NetBeansProjects/C_Programs'
"/C/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_TDM-Windows/c_programs.exe
make.exe[2]: Entering directory `/f/NetBeansProjects/C_Programs'
mkdir -p build/Debug/MinGW_TDM-Windows
rm -f "build/Debug/MinGW_TDM-Windows/main.o.d"
gcc -c -g -MMD -MP -MF "build/Debug/MinGW_TDM-Windows/main.o.d" -o build/Debug/MinGW_TDM-Windows/main.o main.c
mkdir -p dist/Debug/MinGW_TDM-Windows
gcc -o dist/Debug/MinGW_TDM-Windows/c_programs build/Debug/MinGW_TDM-Windows/main.o build/Debug/MinGW_TDM-Windows/structure_union.o
build/Debug/MinGW_TDM-Windows/structure_union.o: In function `main':
F:\NetBeansProjects\C_Programs/structure_union.c:32: multiple definition of `main'
build/Debug/MinGW_TDM-Windows/main.o:F:\NetBeansProjects\C_Programs/main.c:15: first defined here
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW_TDM-Windows/c_programs.exe] Error 1
make.exe[2]: Leaving directory `/f/NetBeansProjects/C_Programs'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/f/NetBeansProjects/C_Programs'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 657ms)
can somebody help me with what im doing wrong? 有人可以帮我做错什么吗?
You have multiple main()
functions in your project: 您的项目中有多个
main()
函数:
[…]/structure_union.c:32: multiple definition of `main'
[…] /structure_union.c:32: “ main”的多个定义
It seems there's one in structure_union
and another one in main.c
(line 15). 似乎在
structure_union
有一个,在main.c
另一个(第15行)。
C allows only one definition of main()
; C只允许定义
main()
; remove one of these and it should work. 删除其中之一,它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.