【问题标题】:MinGW does not see the library in NetBeansMinGW 在 NetBeans 中看不到库
【发布时间】:2020-08-23 01:12:12
【问题描述】:

我正在尝试在 NetBeans 中配置项目的编译。

我从GitHub 下载了最新版本的库程序集。解压到系统根目录下。

在NetBeans中指明了存放“include、bin、lib”目录的路径。

编写代码时,IDE 会提取必要的标头,代码看起来正确无误。编译时,在项目属性中指定必要的键:-lallegro_dialog -lallegro_primitives -lallegro

但是由于某种原因,编译库时没有拉取Netbeans会抛出错误。

cd 'C:\NetBeans\AllegroTest'
C:\MinGW\msys\1.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\1.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)

Then I recorded a visual video

【问题讨论】:

    标签: c netbeans mingw allegro allegro5


    【解决方案1】:

    您的工具链是 32 位的,但您在 NetBeans 中设置的库是为 64 位构建的。

    【讨论】:

      【解决方案2】:

      我正在处理的问题已经解决了。事实是我来自俄罗斯,并且我在操作系统中进行了俄语本地化,并且正在路上有俄语字母。因此,无法访问附加的库。但我修复了一切,现在一切都为我编译成功了。

      我设法使用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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-24
        • 1970-01-01
        相关资源
        最近更新 更多