简体   繁体   English

使用tdm-gcc msys构建netbeans C程序失败

[英]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.

相关问题 C语言上的基本插入排序算法(TDM-GCC编译器) - Basic Insertion Sort Algorithm on C (TDM-GCC compiler) TDM-GCC-在Kernighan&Ritchie的Storage Allocator实施程序中对sbrk()的未定义引用 - TDM-GCC - undefined reference to sbrk() in Kernighan & Ritchie's Storage Allocator implementation program 此TRIE算法代码在CS50 IDE编译器上运行,但是在Windows的TDM-GCC中进入无限循环 - This TRIE algorithm code runs on CS50 IDE compiler but goes into an infinite loop in TDM-GCC on Windows 为什么我不能检查我是否在 tdm-gcc 编译器中包含了 stdlib.h? - Why cant i check if i have included stdlib.h on tdm-gcc compiler? 在Netbeans中编译C程序,但不使用gcc在cmd中编译 - C program compiling in Netbeans, but not compiling in cmd with gcc netbeans8.2 + msys2_64 + mingw64 + cygwin64 + C 项目构建错误 - netbeans8.2 + msys2_64 + mingw64 + cygwin64 + C project build errors 字符串连接在 C 中不起作用 (TDM-GCC-64) - String Concatenation not working in C (TDM-GCC-64) 使用 gcc 编译 C 程序 - Compiling a C program with gcc Gcc可以构建一个可执行程序吗? - Can Gcc build a executable program? 如何在没有MSYS2的Windows上构建GTK + 3程序? - How to build a GTK+3 program on Windows without MSYS2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM