MinGW 看不到 NetBeans 中的库
MinGW does not see the library in NetBeans
我正在尝试在 NetBeans 中配置项目的编译。
我从 GitHub 下载了最新版本的程序集库。解压到系统根目录。
在NetBeans中指明存放"include, bin, lib"目录的路径。
编写代码时,IDE 提取必要的 headers,代码看起来正确,没有错误。编译时,在项目属性中指定必要的键:-lallegro_dialog -lallegro_primitives -lallegro
但由于某些原因,编译时未提取库并且 Netbeans 抛出错误。
cd 'C:\NetBeans\AllegroTest'
C:\MinGW\msys.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/NetBeans/AllegroTest'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe
make.exe[2]: Entering directory `/c/NetBeans/AllegroTest'
mkdir -p dist/Debug/MinGW-Windows
gcc -lallegro_dialog -lallegro_primitives -lallegro -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_dialog
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_primitives
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1
make.exe[2]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe": *** [.build-impl] Error 2
СОБРАТЬ FAILED (значение выхода 2,, общее время: 453ms)
如果我不使用按键 -lallegro_dialog -lallegro_primitives -lallegro 那么
cd 'C:\NetBeans\AllegroTest'
C:\MinGW\msys.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/NetBeans/AllegroTest'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe
make.exe[2]: Entering directory `/c/NetBeans/AllegroTest'
mkdir -p dist/Debug/MinGW-Windows
gcc -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o
build/Debug/MinGW-Windows/main.o: In function `main':
C:\NetBeans\AllegroTest/main.c:23: undefined reference to `al_install_system'
C:\NetBeans\AllegroTest/main.c:25: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:30: undefined reference to `al_create_display'
C:\NetBeans\AllegroTest/main.c:34: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:39: undefined reference to `al_init_primitives_addon'
C:\NetBeans\AllegroTest/main.c:40: undefined reference to `al_install_keyboard'
C:\NetBeans\AllegroTest/main.c:42: undefined reference to `al_create_event_queue'
C:\NetBeans\AllegroTest/main.c:46: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:51: undefined reference to `al_get_keyboard_event_source'
C:\NetBeans\AllegroTest/main.c:51: undefined reference to `al_register_event_source'
C:\NetBeans\AllegroTest/main.c:52: undefined reference to `al_get_display_event_source'
C:\NetBeans\AllegroTest/main.c:52: undefined reference to `al_register_event_source'
C:\NetBeans\AllegroTest/main.c:57: undefined reference to `al_wait_for_event'
C:\NetBeans\AllegroTest/main.c:109: undefined reference to `al_map_rgb'
C:\NetBeans\AllegroTest/main.c:109: undefined reference to `al_draw_filled_rectangle'
C:\NetBeans\AllegroTest/main.c:110: undefined reference to `al_flip_display'
C:\NetBeans\AllegroTest/main.c:111: undefined reference to `al_map_rgb'
C:\NetBeans\AllegroTest/main.c:111: undefined reference to `al_clear_to_color'
C:\NetBeans\AllegroTest/main.c:114: undefined reference to `al_destroy_display'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1
make.exe[2]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe": *** [.build-impl] Error 2
СОБРАТЬ FAILED (значение выхода 2,, общее время: 1s)
您的工具链是 32 位的,但您在 NetBeans 中设置的库是为 64 位构建的。
我遇到的问题已经解决了。事实是我来自俄罗斯,我在操作系统中进行了俄语本地化,并且途中有俄语字母。因此,无法访问附加的库。但我修复了一切,现在一切都为我成功编译了。
我设法使用 THIS 库包进行编译。最初,我想单独下载每个库,但后来我再次仔细查看了主站点上的所有内容。我设法使用这些键成功编译:
-lallegro_monolith-static -static -ljpeg -ldumb -lwebp \
-lFLAC -lvorbisfile -lvorbis -logg -lphysfs -lfreetype \
-lpng16 -ldsound -lgdiplus -luuid -lkernel32 -lwinmm \
-lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 \
-lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -lpthread \
-static-libstdc++ -static-libgcc -lz -lopusfile -lopus
或
-lallegro_dialog-static -lallegro_acodec-static -lallegro_audio-static \
-lallegro_image-static -lallegro_primitives-static -lallegro_ttf-static \
-lallegro_font-static -lallegro-static -static -ljpeg -ldumb -lwebp -lFLAC \
-lvorbisfile -lvorbis -logg -lphysfs -lfreetype -lpng16 -ldsound -lgdiplus \
-luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 \
-lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -lpthread \
-static-libstdc++ -static-libgcc -lz -lopusfile -lopus
我正在尝试在 NetBeans 中配置项目的编译。
我从 GitHub 下载了最新版本的程序集库。解压到系统根目录。
在NetBeans中指明存放"include, bin, lib"目录的路径。
编写代码时,IDE 提取必要的 headers,代码看起来正确,没有错误。编译时,在项目属性中指定必要的键:-lallegro_dialog -lallegro_primitives -lallegro
但由于某些原因,编译时未提取库并且 Netbeans 抛出错误。
cd 'C:\NetBeans\AllegroTest'
C:\MinGW\msys.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/NetBeans/AllegroTest'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe
make.exe[2]: Entering directory `/c/NetBeans/AllegroTest'
mkdir -p dist/Debug/MinGW-Windows
gcc -lallegro_dialog -lallegro_primitives -lallegro -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_dialog
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_primitives
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1
make.exe[2]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe": *** [.build-impl] Error 2
СОБРАТЬ FAILED (значение выхода 2,, общее время: 453ms)
如果我不使用按键 -lallegro_dialog -lallegro_primitives -lallegro 那么
cd 'C:\NetBeans\AllegroTest'
C:\MinGW\msys.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/NetBeans/AllegroTest'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe
make.exe[2]: Entering directory `/c/NetBeans/AllegroTest'
mkdir -p dist/Debug/MinGW-Windows
gcc -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o
build/Debug/MinGW-Windows/main.o: In function `main':
C:\NetBeans\AllegroTest/main.c:23: undefined reference to `al_install_system'
C:\NetBeans\AllegroTest/main.c:25: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:30: undefined reference to `al_create_display'
C:\NetBeans\AllegroTest/main.c:34: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:39: undefined reference to `al_init_primitives_addon'
C:\NetBeans\AllegroTest/main.c:40: undefined reference to `al_install_keyboard'
C:\NetBeans\AllegroTest/main.c:42: undefined reference to `al_create_event_queue'
C:\NetBeans\AllegroTest/main.c:46: undefined reference to `al_show_native_message_box'
C:\NetBeans\AllegroTest/main.c:51: undefined reference to `al_get_keyboard_event_source'
C:\NetBeans\AllegroTest/main.c:51: undefined reference to `al_register_event_source'
C:\NetBeans\AllegroTest/main.c:52: undefined reference to `al_get_display_event_source'
C:\NetBeans\AllegroTest/main.c:52: undefined reference to `al_register_event_source'
C:\NetBeans\AllegroTest/main.c:57: undefined reference to `al_wait_for_event'
C:\NetBeans\AllegroTest/main.c:109: undefined reference to `al_map_rgb'
C:\NetBeans\AllegroTest/main.c:109: undefined reference to `al_draw_filled_rectangle'
C:\NetBeans\AllegroTest/main.c:110: undefined reference to `al_flip_display'
C:\NetBeans\AllegroTest/main.c:111: undefined reference to `al_map_rgb'
C:\NetBeans\AllegroTest/main.c:111: undefined reference to `al_clear_to_color'
C:\NetBeans\AllegroTest/main.c:114: undefined reference to `al_destroy_display'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1
make.exe[2]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/NetBeans/AllegroTest'
make.exe": *** [.build-impl] Error 2
СОБРАТЬ FAILED (значение выхода 2,, общее время: 1s)
您的工具链是 32 位的,但您在 NetBeans 中设置的库是为 64 位构建的。
我遇到的问题已经解决了。事实是我来自俄罗斯,我在操作系统中进行了俄语本地化,并且途中有俄语字母。因此,无法访问附加的库。但我修复了一切,现在一切都为我成功编译了。
我设法使用 THIS 库包进行编译。最初,我想单独下载每个库,但后来我再次仔细查看了主站点上的所有内容。我设法使用这些键成功编译:
-lallegro_monolith-static -static -ljpeg -ldumb -lwebp \
-lFLAC -lvorbisfile -lvorbis -logg -lphysfs -lfreetype \
-lpng16 -ldsound -lgdiplus -luuid -lkernel32 -lwinmm \
-lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 -lgdi32 \
-lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -lpthread \
-static-libstdc++ -static-libgcc -lz -lopusfile -lopus
或
-lallegro_dialog-static -lallegro_acodec-static -lallegro_audio-static \
-lallegro_image-static -lallegro_primitives-static -lallegro_ttf-static \
-lallegro_font-static -lallegro-static -static -ljpeg -ldumb -lwebp -lFLAC \
-lvorbisfile -lvorbis -logg -lphysfs -lfreetype -lpng16 -ldsound -lgdiplus \
-luuid -lkernel32 -lwinmm -lpsapi -lopengl32 -lglu32 -luser32 -lcomdlg32 \
-lgdi32 -lshell32 -lole32 -ladvapi32 -lws2_32 -lshlwapi -lpthread \
-static-libstdc++ -static-libgcc -lz -lopusfile -lopus