Hello everybody !
Once again i come back to you with a simple/weird (stupid?) question, and a new bug i cant figure out how to fix.
here's my code:
main.cpp
Planet.h
Planet.cpp
What i figured out :
-The code compiles.
-The display opens, and i got the "It works" message in the console.
-The display stays black, and i get an error code after a few secs (0XC0000005)
-When i remove the al_draw_circle call, the code runs, and returns 0.
-When i call al_draw_circle from the main, it works.
Please help !
Have a great day !
Edit: The problem is not coming from here (i simplified the problem in this forum thread, but i think the problem comes from another part of the code)7
Edit 2: This is so confusing, i cant get it to work. Do you see any mistakes i've made in these sources ?
I see one thing. You're using a global const ALLEGRO_COLOR and caling al_map_rgb outside of al_init() because global constructors get called before main.
Calling allegro functions before al_init can give undefined behavior.
EDIT
Also, that code won't compile because you didn't #include "planet.h".
Post a minimal working example that compiles if the above didn't fix the problem.
I see one thing. You're using a global const ALLEGRO_COLOR and caling al_map_rgb outside of al_init() because global constructors get called before main.
Calling allegro functions before al_init can give undefined behavior.
Oh ! Very interesting ! Thx for the answer !
Also, that code won't compile because you didn't #include "planet.h"
Oh yea my bad, this error comes from when i tried to synthetize the problem and refactored the code to describe my problem better. (As i told, my code compiles ^^)
Post a minimal working example that compiles if the above didn't fix the problem.
This example is not relevant anymore, i've made a new post, with all the actual sources, and one new hell of an issue ;p
Great day !