allegro5
allegro5 copied to clipboard
Doesn't run in vscode on linux mint
I followed the information on the wiki repo and I am getting undefined reference errors everywhere
[Running] cd "/home/shadowblitz16/Documents/Projects/Code/SimpleList/" && g++ main.cpp -o main && "/home/shadowblitz16/Documents/Projects/Code/SimpleList/"main
/usr/bin/ld: /tmp/ccla0vfs.o: in function `main':
main.cpp:(.text+0x1d): undefined reference to `al_install_system'
/usr/bin/ld: main.cpp:(.text+0x22): undefined reference to `al_init_font_addon'
/usr/bin/ld: main.cpp:(.text+0x27): undefined reference to `al_init_ttf_addon'
/usr/bin/ld: main.cpp:(.text+0x36): undefined reference to `al_create_display'
/usr/bin/ld: main.cpp:(.text+0x50): undefined reference to `al_load_ttf_font'
/usr/bin/ld: main.cpp:(.text+0x96): undefined reference to `al_map_rgb'
/usr/bin/ld: main.cpp:(.text+0xbd): undefined reference to `al_clear_to_color'
/usr/bin/ld: main.cpp:(.text+0xd1): undefined reference to `al_map_rgb'
/usr/bin/ld: main.cpp:(.text+0x113): undefined reference to `al_draw_text'
/usr/bin/ld: main.cpp:(.text+0x118): undefined reference to `al_flip_display'
collect2: error: ld returned 1 exit status
[Done] exited with code=1 in 0.51 seconds
this is what my code looks like..
#include <iostream>
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
int main()
{
al_init();
al_init_font_addon();
al_init_ttf_addon();
ALLEGRO_DISPLAY* display = al_create_display(512,480);
ALLEGRO_FONT * font = al_load_ttf_font("assets/pico8.ttf", 64, 0);
std::cout << (font == nullptr) << std::endl;
while (true)
{
al_clear_to_color(al_map_rgb(255,255,255));
al_draw_text(font, al_map_rgb(0,0,0), 0, 0, 0, "Hello World!");
al_flip_display();
}
al_destroy_display(display);
al_destroy_font(font);
return 0;
}
You need to tell g++ to link in the Allegro libraries.
What wiki page were you following? If it tells you to compile like that, it's bad advice.
@pedro-w I was following YouTube tutorials. also I was using vs code's runner plugin.
I moved to windows and got it working.
I still have no idea how to actually run it from vs code.
@Shadowblitz16 : To consult doubts or problems, you can visit the Allegro forum:
https://www.allegro.cc/forums/board/programming
EDIT: You must also say the links of the tutorials, guides or wiki that you followed.
I've made some notes on this but I haven't typed them up yet
@Shadowblitz16 I've done this https://github.com/liballeg/allegro_wiki/wiki/Using-Visual-Studio-Code Still a WIP so I haven't linked it to the main content of the wiki. What do you think?
I don't know everytime I try c or c++ I run into a enormous amount of issues..
- ide's and text editors not working
- the requirement of make files
- compiler errors that don't maker sense.
I think me staying away from c and c++ is probably a good thing. however I hope that this issue I raised will help someone else
It's like riding a bike. Here is not the place for discussion, though, why not go to allegro.cc and people will help you.