c - 如何修复 netbeans 中的此错误?

标签 c netbeans

我收到此错误消息。我尝试使用 CYGWIN 获得正确的结果,我做错了什么吗?您需要更多信息吗?

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
cygwin warning:
  MS-DOS style path detected: build/Debug/Cygwin_4.x-Windows/hello\.d
  Preferred POSIX equivalent is: build/Debug/Cygwin_4.x-Windows/hello/.d
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe
make[2]: Entering directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
mkdir -p dist/Debug/Cygwin_4.x-Windows
gcc     -o dist/Debug/Cygwin_4.x-Windows/playing_with_c build/Debug/Cygwin_4.x-Windows/hello\ world.o  build/Debug/Cygwin_4.x-Windows/main.o  
nbproject/Makefile-Debug.mk:63: recipe for target `dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe' failed
make[2]: Leaving directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
nbproject/Makefile-Debug.mk:60: recipe for target `.build-conf' failed
make[1]: Leaving directory `/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed
build/Debug/Cygwin_4.x-Windows/main.o: In function `main':
/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c/main.c:14: multiple definition of `_main'
build/Debug/Cygwin_4.x-Windows/hello world.o:/cygdrive/c/Users/Liam/Documents/NetBeansProjects/playing with c/hello world.c:3: first defined here
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/playing_with_c.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2


BUILD FAILED (exit value 2, total time: 3s)

最佳答案

您已在多个位置定义了 main 方法:main.c:14 和 hello world.c:3。

一个程序只能有 1 个主方法。

从项目中删除这些文件之一,或删除主要方法定义之一。

关于c - 如何修复 netbeans 中的此错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12118877/

相关文章:

java - 单击按钮时应该打开新窗口吗?

c - 无效的读取、写入和释放

c - 尝试打印堆栈的元素时堆栈实现崩溃

c - 信号量不会让进程休眠

c++ - 如何获取 __COUNTER__ 的最后一个值

c - 结构体值在传回 main 时不保留

netbeans - 如何在 Netbeans 中从特定包(不含 main)创建 .jar?

tomcat - 无法在 Netbeans 7.1 中添加外部服务器 Tomcat

java - Swing:仅使用 Netbeans 将 JFormattedTextField 设置为数字

java - 如何在计算中包括和排除复选框?集成开发环境