• Advertisement
Sign in to follow this  

Allegro problems

This topic is 3400 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am using code::blocks trying to use allegro, my code is: #include "allegro.h" int main(void) { return 0; } END_OF_MAIN() here is the error log: -------------- Build: Debug in Game --------------- Linking console executable: bin\Debug\Game.exe obj\Debug\main.o: In function `WinMain': C:/Users/Hannah/Desktop/Game/main.cpp:7: undefined reference to `_WinMain' collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings after googling the error, the only fix i could find was making sure END_OF_MAIN() is at the end of the code, and it is...

Share this post


Link to post
Share on other sites
Advertisement

#include <allegro.h>
int main(void) {
allegro_init();
allegro_message("Hello");
allegro_exit();
return 0;
}
END_OF_MAIN()





I think that may solve your problem...

allegro_init() is required to use the allegro header file. If you dont use it
the program will crash at worst and not work at best.

The book I got a few days ago uses allegro to build games with and by far has some good information.
The name of it is, Game Programming ALL IN ONE Third Edition by Jonhathan S. Harbour.

Share this post


Link to post
Share on other sites
Quote:
Original post by fruni
I am using code::blocks trying to use allegro, my code is:

#include "allegro.h"

int main(void)
{
return 0;
}
END_OF_MAIN()

here is the error log:


-------------- Build: Debug in Game ---------------

Linking console executable: bin\Debug\Game.exe
obj\Debug\main.o: In function `WinMain':
C:/Users/Hannah/Desktop/Game/main.cpp:7: undefined reference to `_WinMain'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings

after googling the error, the only fix i could find was making sure END_OF_MAIN() is at the end of the code, and it is...


I have never used Allegro, but I have a guess as to the problem.

Based on the pasted error, it seems like the problem might be that you created a console project (or whatever the code::blocks equivalent of project is) instead of a windows project. This guess is based on the references to WinMain in the error message (which is the main entry point for a windows application).

Another problem it could be is that you don't have the allegro library linked in. Unfortunately, I don't use Code::Blocks, so I can't direct how to do that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement