![]() |
|
[linker error] undefined reference to 'atexit' |
Denis Sinner
Member #4,278
January 2004
|
Hi there, |
kdevil
Member #1,075
March 2001
![]() |
Any code you care to show us? ----- |
Denis Sinner
Member #4,278
January 2004
|
#include <allegro.h> int main(int argc, char **argv){ |
kdevil
Member #1,075
March 2001
![]() |
Try this: #include <allegro.h> int main() { allegro_init(); allegro_message("Hello World!"); allegro_exit(); return 0; } END_OF_MAIN()
----- |
Zaphos
Member #1,468
August 2001
|
Sounds like a standard (defaultly linked) library is not being linked in. atexit() should certainly exist and be linked in with your project, it's a function in stdlib.h -- did you perhaps toy with the linker settings when you were telling to dev-cpp to link in allegro? If so, try undo-ing those changed. I would be greatly surprised if kdevil's suggestion works, since atexit() is probably called by allegro regardless of whether an explicit call to allegro_exit is made. There is no reason I know of to explicitly call allegro_exit if you plan to use allegro for the duration of the program runtime; for an allegro game, certainly, the call is probably deadweight.
|
CGamesPlay
Member #2,559
July 2002
![]() |
You must be linking statically, right? Because the dll would have the unresolved symbol else, no? -- Ryan Patterson - <http://cgamesplay.com/> |
gillius
Member #119
April 2000
|
Guys keep in mind that allegro_init is a macro, as allegro_init is the old-Allegro 3.0 style function. The new function is install_allegro which is compatible with dynamic linking operating systems (such as Windows and Linux) as it contains a driver ID, errno pointer, and atexit pointer to register itself. So atexit is directly used by the allegro_init macro. Gillius |
kdevil
Member #1,075
March 2001
![]() |
Yeah, I'm not really sure why I thought adding allegro_exit() would fix it. It's probably something in the linker settings like Zaphos said. ----- |
|