Public Group

Allegro problems

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

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 on other sites
#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 on other sites
Quote:
 Original post by fruniI 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.exeobj\Debug\main.o: In function WinMain':C:/Users/Hannah/Desktop/Game/main.cpp:7: undefined reference to _WinMain'collect2: ld returned 1 exit statusProcess terminated with status 1 (0 minutes, 0 seconds)1 errors, 0 warningsafter 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.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 14
• 9
• 9
• 9
• 10
• Forum Statistics

• Total Topics
632912
• Total Posts
3009199
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!