User forums > Using Code::Blocks
undefined reference to 'WinMain@16 error message
stahta01:
Per offsite FAQ, "-mwindows" goes into the linker other/extra settings; it looks like you put it into the compiler other/extra settings.
Tim S.
jerryd:
stahta01,
I read both of BlueHazzard's suggested links.
His first one suggested that I follow his format which is why I updated
my post to his specs.
His second suggested a link at:
http://wiki.libsdl.org/FAQWindows#I_get_.22Undefined_reference_to_.27WinMain.4016.27.22 WHICH OFFERED THE SEVERAL SUGGESTIONS.
ONE SUGGESTION WAS:
"SDL can be built with Visual C++, Cygwin, MinGW, and Dev-C++".
Code:Blocks isn't mentioned but there were many web sites showing
how use SDL with Code:Blocks.
I used Lazy Foo' tutorial at:
http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/codeblocks/index.php
I'M NOT USING VISUAL C++ SO SOME THINGS DON'T APPLY.
IN THE WINDOWS SECTION AT http://wiki.libsdl.org/Installation it said
"optionally link SDLmain.lib if you want SDL to provide a WinMain()".
I REMOVED THIS LINK BUT STILL GOT THE SAME ERROR MESSAGE.
Is there some other way I should post this or is there something else
I should post?
Jerry D.
stahta01:
--- Quote from: stahta01 on December 10, 2016, 12:14:36 am ---Per offsite FAQ, "-mwindows" goes into the linker other/extra settings; it looks like you put it into the compiler other/extra settings.
Tim S.
--- End quote ---
Edit: I have no idea if this flag is needed or not. I am guessing it will be needed later.
stahta01:
I suggest you use SDL2 Hello world code instead of the code that is C Hello world.
If you want a better site on using Code::Blocks and SDL2; I would suggest http://www.willusher.io/pages/sdl2/
But, most people do use the Lazy Foo's site; I really NOT sure what help I can give since you seem to NOT know what questions are valid for this site. Try to ask a valid CB Question; after reading the rules http://forums.codeblocks.org/index.php/topic,9996.0.html
NOTE: The real thing you need to learn is the information about your compiler!
Is it MinGW32 GCC or MinGW64 GCC?
Is it an 64 bit or 32 bit compiler?
What GCC version is it?
The most important is 64 or 32 bit compiler.
I will create a CB Project Template using the code from http://www.willusher.io/pages/sdl2/ and post it in this thread.
DO NOT START ANOTHER THREAD ON THE SAME TOPIC!
I will be using an 32 bit MinGW32 GCC compiler for my building of the CB Template project.
Tim S.
stahta01:
Added CB Template file.
Setting -> Global Varible
My Global Variable setting are this
Variable name: sdl2
Base: C:\SDL2-2.0.5\i686-w64-mingw32
In my case this means "$(#sdl2.include)" is replaced by CB with "C:\SDL2-2.0.5\i686-w64-mingw32\include".
$(#sdl2.lib) is replaced by CB with "C:\SDL2-2.0.5\i686-w64-mingw32\lib".
$(#sdl2.bin) is replaced by CB with "C:\SDL2-2.0.5\i686-w64-mingw32\bin".
Just unzipped the template file into a directory and set the global variable and post the build log.
Please try to use code tags that is the "#" button in the menu.
Tim S.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version