-2

I'm trying to create a small game using Allegro. I've already downloaded the library and it is now on usr/include/allegro. When I'm trying to compile I get:

/usr/bin/ld: /tmp/ccvQ9fiI.o: in function `main':
first_test.c++:(.text+0x1d): undefined reference to `al_install_system'
/usr/bin/ld: first_test.c++:(.text+0x22): undefined reference to `al_init_font_addon'
/usr/bin/ld: first_test.c++:(.text+0x31): undefined reference to `al_create_display'
/usr/bin/ld: first_test.c++:(.text+0x3a): undefined reference to `al_create_builtin_font'
/usr/bin/ld: first_test.c++:(.text+0x52): undefined reference to `al_map_rgb'
/usr/bin/ld: first_test.c++:(.text+0x78): undefined reference to `al_clear_to_color'
/usr/bin/ld: first_test.c++:(.text+0x8c): undefined reference to `al_map_rgb'
/usr/bin/ld: first_test.c++:(.text+0xd5): undefined reference to `al_draw_text'
/usr/bin/ld: first_test.c++:(.text+0xda): undefined reference to `al_flip_display'
collect2: error: ld returned 1 exit status

The thing is I've included correctly the library, it seems like the compiler could not find the library. How can I fix that? I also get a problem with limit.h, it also seems missing for the compiler (libc6-dev is installed)

I'm using vs-code with c++ on Ubuntu for the first time. Did I miss something?

I've tried including manually the library. No way.

I've tried with

#inlcude "/usr/include/allegro5/allegro.h"
  • Libraries don't go in `/usr/include/` (that's for header files which you can `#include`). Libraries live under `/usr/lib`. Or set `LD_LIBRARY_PATH` to point the linker to the right directory. If that doesn't work, [edit] your question and clarify what you mean by "tried manually including the library". Include how you call the compiler. We need to be able to reproduce the problem. – Robert Aug 09 '23 at 15:07

0 Answers0