Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » MinGW does not see the library

This thread is locked; no one can reply to it. rss feed Print
MinGW does not see the library
Alexander Zhirov
Member #17,695
May 2020
avatar

I am trying to configure compilation of a project in NetBeans.
{"name":"d1f22c6e5fa1.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/b\/7bc8f42f11b9d8c8633ca4e828667de6.png","w":783,"h":664,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/b\/7bc8f42f11b9d8c8633ca4e828667de6"}d1f22c6e5fa1.png
I downloaded the latest version of the library assembly from GitHub. Unpacked to the root of the system directory.
{"name":"e58bf69dc847.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/9\/792fabf6a1360d5100c348d9fa3e7db5.png","w":1059,"h":519,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/9\/792fabf6a1360d5100c348d9fa3e7db5"}e58bf69dc847.png
In NetBeans indicated the path to store the "include, bin, lib" directory.
{"name":"3ca6fa204bc9.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/f\/5f27034604d0aa0cd478cd8be4a8ff6c.png","w":940,"h":350,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/f\/5f27034604d0aa0cd478cd8be4a8ff6c"}3ca6fa204bc9.png
When writing code, the IDE pulls up the necessary headers and the code looks correct, without errors. When compiling, in the project properties specified the necessary keys: -lallegro_dialog -lallegro_primitives -lallegro
{"name":"e84e50d49a79.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a0daca5513d0ae28dc4fae17ae729b8.png","w":912,"h":505,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/a\/6a0daca5513d0ae28dc4fae17ae729b8"}e84e50d49a79.png
But for some reason, when compiling libraries are not pulled and Netbeans throws errors.
full image
{"name":"ba899c62c42c.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/2\/529f6cf787da4206844a3695e58e421a.png","w":2560,"h":951,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/2\/529f6cf787da4206844a3695e58e421a"}ba899c62c42c.png

#SelectExpand
1cd 'C:\AllegroTest' 2C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug 3"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf 4make.exe[1]: Entering directory `/c/AllegroTest' 5"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe 6make.exe[2]: Entering directory `/c/AllegroTest' 7mkdir -p dist/Debug/MinGW-Windows 8gcc -lallegro_dialog -lallegro_primitives -lallegro -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o 9c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_dialog 10c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro_primitives 11c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lallegro 12collect2.exe: error: ld returned 1 exit status 13make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1 14make.exe[2]: Leaving directory `/c/AllegroTest' 15make.exe[1]: *** [.build-conf] Error 2 16make.exe[1]: Leaving directory `/c/AllegroTest' 17make.exe": *** [.build-impl] Error 2 18 19СОБРАТЬ FAILED (значение выхода 2,, общее время: 940ms)

If i don't use keys -lallegro_dialog -lallegro_primitives -lallegro then

#SelectExpand
1cd 'C:\AllegroTest' 2C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug 3"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf 4make.exe[1]: Entering directory `/c/AllegroTest' 5"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/allegrotest.exe 6make.exe[2]: Entering directory `/c/AllegroTest' 7mkdir -p dist/Debug/MinGW-Windows 8gcc -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o 9build/Debug/MinGW-Windows/main.o: In function `main': 10C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:23: undefined reference to `al_install_system' 11C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:25: undefined reference to `al_show_native_message_box' 12C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:30: undefined reference to `al_create_display' 13C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:34: undefined reference to `al_show_native_message_box' 14C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:39: undefined reference to `al_init_primitives_addon' 15C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:40: undefined reference to `al_install_keyboard' 16C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:42: undefined reference to `al_create_event_queue' 17C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:46: undefined reference to `al_show_native_message_box' 18C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:51: undefined reference to `al_get_keyboard_event_source' 19C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:51: undefined reference to `al_register_event_source' 20C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:52: undefined reference to `al_get_display_event_source' 21C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:52: undefined reference to `al_register_event_source' 22C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:57: undefined reference to `al_wait_for_event' 23C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:109: undefined reference to `al_map_rgb' 24C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:109: undefined reference to `al_draw_filled_rectangle' 25C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:110: undefined reference to `al_flip_display' 26C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:111: undefined reference to `al_map_rgb' 27C:\Users\\Documents\NetBeansProjects\AllegroTest/main.c:111: undefined reference to `al_clear_to_color' 28C:\Users\Администратор\Documents\NetBeansProjects\AllegroTest/main.c:114: undefined reference to `al_destroy_display' 29collect2.exe: error: ld returned 1 exit status 30make.exe[2]: *** [dist/Debug/MinGW-Windows/allegrotest.exe] Error 1 31make.exe[2]: Leaving directory `/c/AllegroTest' 32make.exe[1]: *** [.build-conf] Error 2 33make.exe[1]: Leaving directory `/c/AllegroTest' 34make.exe": *** [.build-impl] Error 2 35 36СОБРАТЬ FAILED (значение выхода 2,, общее время: 1s)

I have already copied bin to MinGW itself, but this did not work. I ask for help.:(
Screencast

Peter Hull
Member #1,136
March 2001

It is finding the headers OK (otherwise you would get compile errors when compiling .c to .o) but not the libraries.
Usually either the libs are in the compiler's standard locations, or the command line would mention them specifically, for example:

gcc -Lpath/to/allegro/libraries -lallegro_dialog -lallegro_primitives -lallegro    -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o

Can you show us what nbproject/Makefile-Debug.mk looks like?

Also: the directory you put a red box around looks to be a 64-bit one, but your compiler is mingw32. Are you trying to link a 32-bit program with 64 bit libraries?
Edgar is the expert on this stuff (if I was working in Windows I'd use VS and the NuGet packages rather than MinGW)

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

One problem is link order. You have to link after you compile your main .o file.

gcc -lallegro_dialog -lallegro_primitives -lallegro -o dist/Debug/MinGW-Windows/allegrotest build/Debug/MinGW-Windows/main.o

-l goes after main.o in this case

Go to: