gpt4 book ai didi

c++ - 在 Netbeans 中构建 C++ 项目并出现大量 undefined reference 错误(需要链接 GDI?)

转载 作者:行者123 更新时间:2023-11-28 08:12:07 25 4
gpt4 key购买 nike

我正在尝试编译我发现的旧 AI 项目 here .我正在使用 Netbeans 7.1 我已经安装了 cygwin 和适当的包,因为我可以编译所有 Netbeans 示例项目。我已将所有文件放入名为“sweepers”的项目中,当我尝试构建它时,我得到以下输出:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin-Windows/sweepers.exe
make[2]: Entering directory `/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers'
mkdir -p dist/Debug/Cygwin-Windows
g++.exe -o dist/Debug/Cygwin-Windows/sweepers build/Debug/Cygwin-Windows/_ext/1369961084/CMinesweeper.o build/Debug/Cygwin-Windows/_ext/1369961084/utils.o build/Debug/Cygwin-Windows/_ext/1369961084/C2DMatrix.o build/Debug/Cygwin-Windows/_ext/1369961084/CNeuralNet.o build/Debug/Cygwin-Windows/_ext/1369961084/main.o build/Debug/Cygwin-Windows/_ext/1369961084/CTimer.o build/Debug/Cygwin-Windows/_ext/1369961084/CGenAlg.o build/Debug/Cygwin-Windows/_ext/1369961084/CParams.o build/Debug/Cygwin-Windows/_ext/1369961084/CController.o -L/cygdrive/C/cygwin/lib -L/cygdrive/C/cygwin/lib/w32api
build/Debug/Cygwin-Windows/_ext/1369961084/main.o: In function `_Z10WindowProcP6HWND__jjl':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:76: undefined reference to `_CreateCompatibleDC@4'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:80: undefined reference to `_CreateCompatibleBitmap@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:85: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:136: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:140: undefined reference to `_CreateCompatibleBitmap@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:145: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:157: undefined reference to `_BitBlt@36'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:171: undefined reference to `_BitBlt@36'
make[2]: Leaving directory `/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:180: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:183: undefined reference to `_DeleteDC@4'
make[1]: Leaving directory `/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/main.cpp:184: undefined reference to `_DeleteObject@4'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CControllerC2EP6HWND__':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:82: undefined reference to `_CreatePen@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:83: undefined reference to `_CreatePen@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:84: undefined reference to `_CreatePen@12'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CControllerC1EP6HWND__':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:82: undefined reference to `_CreatePen@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:83: undefined reference to `_CreatePen@12'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o:/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:84: more undefined references to `_CreatePen@12' follow
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CControllerD2Ev':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:112: undefined reference to `_DeleteObject@4'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:113: undefined reference to `_DeleteObject@4'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:114: undefined reference to `_DeleteObject@4'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:115: undefined reference to `_DeleteObject@4'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CControllerD1Ev':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:112: undefined reference to `_DeleteObject@4'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o:/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:113: more undefined references to `_DeleteObject@4' follow
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CController6RenderEP5HDC__':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:225: undefined reference to `_TextOutA@20'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:231: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:242: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:246: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:249: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:254: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:261: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:271: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:275: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:278: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:281: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:285: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:288: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:290: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:291: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:293: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:297: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:303: undefined reference to `_SelectObject@8'
build/Debug/Cygwin-Windows/_ext/1369961084/CController.o: In function `_ZN11CController9PlotStatsEP5HDC__':
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:321: undefined reference to `_TextOutA@20'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:324: undefined reference to `_TextOutA@20'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:333: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:335: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:339: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:347: undefined reference to `_SelectObject@8'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:349: undefined reference to `_MoveToEx@16'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:353: undefined reference to `_LineTo@12'
/cygdrive/f/Users/Jonathon/Documents/NetBeansProjects/sweepers/../../../Desktop/sweepers/CController.cpp:359: undefined reference to `_SelectObject@8'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin-Windows/sweepers.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2


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

我一直在谷歌搜索这些错误并得出结论我遗漏了一个或多个已包含的库(不过这只是一个猜测,因为这是我第一次在 xCode 之外编译 C++ 或任何类型的 C在 Mac 上。)

有谁知道我在这里做错了什么?我觉得它非常简单,但我只是缺少一条关键信息。

谢谢。

最佳答案

您肯定在链接时遗漏了一些 GDI 库。熟悉 cygwin 的人可能会让您知道如何解决这个问题。

关于c++ - 在 Netbeans 中构建 C++ 项目并出现大量 undefined reference 错误(需要链接 GDI?),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8774443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com