gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

OffTopic > Allegro

#159107 - jake2431 - Wed Jun 25, 2008 4:13 pm

I've wanted to toy with this library for a while. I followed the instructions here: http://wiki.allegro.cc/Setting_up_Code::Blocks_with_Allegro but when I start a project and try to compile some of the example allegro code, I get all kinds of errors. Any suggestions?

Here are the errors I get from the exhello.c
Code:

||=== test, Debug ===|
obj\Debug\main.o||In function `mangled_main':|
C:\Projects\test\main.c|16|undefined reference to `_install_allegro_version_check'|
C:\Projects\test\main.c|20|undefined reference to `install_keyboard'|
C:\Projects\test\main.c|23|undefined reference to `set_gfx_mode'|
C:\Projects\test\main.c|24|undefined reference to `set_gfx_mode'|
C:\Projects\test\main.c|25|undefined reference to `set_gfx_mode'|
C:\Projects\test\main.c|26|undefined reference to `_imp__allegro_error'|
C:\Projects\test\main.c|26|undefined reference to `allegro_message'|
C:\Projects\test\main.c|32|undefined reference to `_imp__desktop_palette'|
C:\Projects\test\main.c|32|undefined reference to `set_palette'|
C:\Projects\test\main.c|35|undefined reference to `makecol'|
C:\Projects\test\main.c|35|undefined reference to `_imp__screen'|
C:\Projects\test\main.c|35|undefined reference to `clear_to_color'|
C:\Projects\test\main.c|41|undefined reference to `acquire_screen'|
C:\Projects\test\main.c|44|undefined reference to `makecol'|
C:\Projects\test\main.c|44|undefined reference to `_imp__gfx_driver'|
C:\Projects\test\main.c|44|undefined reference to `_imp__gfx_driver'|
C:\Projects\test\main.c|44|undefined reference to `_imp__gfx_driver'|
C:\Projects\test\main.c|44|undefined reference to `_imp__gfx_driver'|
C:\Projects\test\main.c|44|undefined reference to `_imp__font'|
C:\Projects\test\main.c|44|undefined reference to `_imp__screen'|
C:\Projects\test\main.c|44|undefined reference to `textout_centre_ex'|
C:\Projects\test\main.c|47|undefined reference to `release_screen'|
C:\Projects\test\main.c|50|undefined reference to `readkey'|
obj\Debug\main.o||In function `WinMain':|
C:\Projects\test\main.c|55|undefined reference to `_WinMain'|
||=== Build finished: 24 errors, 0 warnings ===|

#159110 - Dwedit - Wed Jun 25, 2008 4:59 pm

Make sure you edit your project settings and add the allegro libraries to the list of libraries to link with.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#159118 - jake2431 - Wed Jun 25, 2008 7:29 pm

Got it. Thanks! How do I learn to know what libraries to add and such? I have only followed tutorials that show how to set up environments. I don't actually know what's going on.

#159183 - chatterbug89 - Thu Jun 26, 2008 4:46 pm

There is a command called allegro-config that will automatically list the libraries you need to link in. It's all on the wiki so I'd take a look there (I dont' remember the flags off hand, nor do I know the environment you are using anyway).