Setup Allegro5 on Visual Studio Code on Mac
Onewing

I was going to try out Visual Studio Code on Mac. I haven't really used it before...nor have I really used Allegro 5. It'd be fun to try these things out for the upcoming TINS competition in October. Of course, I wouldn't want to spend time during the competition learning how to use these things. 8-)

Has anyone done this before? I did a search on the site and the googles, but didn't find anything, albeit only after about 5 minutes of searching.

Thoughts on a starting place?

Edgar Reynaldo

I really have no clue what I'm talking about, but it should be as simple as installing Visual Studio code and the Allegro 5 Nuget package.

SiegeLord

Probably not Nuget, as that's Windows-only at the moment. I guess you just install Allegro via homebrew and then do the usual linker options thing?

Edgar Reynaldo

xD I told you I didn't know what I was talking about ;D

Onewing

I'm a bit stuck. VS Code takes some grunt work to get it going, but I finally got it to compile allegro 5 code, yay! Unfortunately, when I run it, al_init is returning a 1. Searching the forums, this seems to be a symptom of having different versions of allegro between compilation and headers (or something like that).

I went to /usr/local/lib and moved files with "5.2.2" and "5.2" off to other folders (in case I need to move them back). Still no luck. Thoughts?

Not sure if it will help, but here's my code and how I'm compiling it.

#SelectExpand
1#define ALLEGRO_NO_MAGIC_MAIN 2#include <allegro5/allegro.h> 3#include <iostream> 4using namespace std; 5 6int real_main(int argc, char **argv) { 7 if(al_init() != 0) { 8 return 1; 9 } 10 11 cout << "Hello world!" << endl; 12 13 return 0; 14} 15 16int main(int argc, char **argv) { 17 return al_run_main(argc, argv, real_main); 18}

Compile flags

#SelectExpand
1g++ -g helloworld.cpp -Wall -ansi -o test20.exe -L/usr/local/lib/ -I/usr/local/include/ -lallegro

SiegeLord

lolz, you know when you're an old A4 programmer when you expect it to return 0 on success ;).

al_init returns a boolean, true when everything worked, false when there was an error.

Onewing

Heh, it didn't even occur to me that the problem was in the code considering how much time I spent making VS Code do my bidding. Made the code change and it worked!

FYI, is it just me or is every tutorial on this page running into an Internal Error? https://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials

Edgar Reynaldo

Yeah, I get the errors too

Thread #617042. Printed from Allegro.cc