Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A4] undefined reference to `_WinMain'|

This thread is locked; no one can reply to it. rss feed Print
[A4] undefined reference to `_WinMain'|
BitCruncher
Member #11,279
August 2009
avatar

#include <allegro.h>



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

I'm trying to revive an old project done in A4, but I've been in A5 too long and can't remember why this linker error occurs...

Compiler: gcc (tdm64-1) 4.5.2
OS: Windows 10 Home
IDE: Code::Blocks

Doctor Cop
Member #16,833
April 2018
avatar

As of how I remember it, the new versions of Allegro4 doesn't compile on TDM flavor.
I can be wrong but it will compile fine on MinGW.

torhu
Member #2,727
September 2002
avatar

Hm, is it just _WinMain and not _WinMain@16 or something like that?

Or, wait, you are compiling in 64-bit mode? Then it's the _WinMain defined in wsystem.c it can't find. Which doesn't make a lot of sense... Are you sure you are actually linking to Allegro?

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

BitCruncher
Member #11,279
August 2009
avatar

Just an update.

I didn't build allegro, but was just using the pre-built binaries for 4.4.2.

Leaving all of the compiler/linker settings the same, I switched to mingw-w64, and it linked the above just fine. As Doctor Cop alluded to, probably something to do with TDM?

@torhu,
Yea, just _WinMain.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

BitCruncher
Member #11,279
August 2009
avatar

.....that's it. I was trying to link against mingw binaries with tdm...

Go to: