Code::Blocks + MSVC++ 2003 Toolkit error when compiling SDL application

Started by
5 comments, last by deavik 18 years, 5 months ago
i use Code::Blocks as my IDE and MSVC++ 2003 Toolkit as the compiler. I tried to compile very basic does-nothing program and i got error. I have included SDL.lib and SDLmain.lib in the project settings>linker and i have enabled multithreaded DLL and executable for both debug and release settings. here's messages that appears right before the error message which i couldn't understand (probably due to enabling multithreaded option)
Quote: cl : Command line warning D4025 : overriding '/MDd' with '/MD' cl : Command line warning D4025 : overriding '/MD' with '/MTd' cl : Command line warning D4025 : overriding '/MTd' with '/MT' cl : Command line warning D4025 : overriding '/MT' with '/MDd' cl : Command line warning D4025 : overriding '/MDd' with '/MD' cl : Command line warning D4025 : overriding '/MD' with '/MTd' cl : Command line warning D4025 : overriding '/MTd' with '/MT' cl : Command line warning D4025 : overriding '/MT' with '/MDd' cl : Command line warning D4025 : overriding '/MDd' with '/MD' cl : Command line warning D4025 : overriding '/MD' with '/MTd' cl : Command line warning D4025 : overriding '/MTd' with '/MT'
here's my error messages:
Quote: SDLmain.lib(SDL_win32_main.obj) : warning LNK4217: locally defined symbol _exit imported in function _main SDLmain.lib(SDL_win32_main.obj) : warning LNK4217: locally defined symbol _strncpy imported in function _main SDLmain.lib(SDL_win32_main.obj) : warning LNK4217: locally defined symbol __pctype imported in function _ParseCommandLine SDLmain.lib(SDL_win32_main.obj) : warning LNK4217: locally defined symbol ___mb_cur_max imported in function _ParseCommandLine SDLmain.lib(SDL_win32_main.obj) : warning LNK4217: locally defined symbol __isctype imported in function _ParseCommandLine SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__strrchr referenced in function _main SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__fprintf referenced in function _ShowError SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp___iob referenced in function _ShowError SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__remove referenced in function _cleanup_output SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__fopen referenced in function _cleanup_output SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__fgetc referenced in function _cleanup_output SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__fclose referenced in function _cleanup_output SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__setbuf referenced in function _WinMain@16 SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__setvbuf referenced in function _WinMain@16 SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp__freopen referenced in function _WinMain@16 SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol __imp___getcwd referenced in function _WinMain@16 SDLapp.exe : fatal error LNK1120: 11 unresolved externals
here's my hello world code:
Quote: #include <SDL/SDL.h> int main ( int argc, char *argv[] ) { return 0; }
i search the forum and googled a bit, and any problem that's similiar to mine can be resolved by setting the multithreading options but in mine, i think that's nt the case :| can anyone help? thank you. ps: what is the bbcode for posting code?
Advertisement
Try this:

#include <windows.h>#include <SDL/SDL.h>int main ( int argc, char *argv[] ){  return 0;}

Also check if you link SDLmain and SDL.
nope, still doesn't work :and i've linked the SDL and SDLmain lib in the linker sections
Well, actually I use mingw compiler, and I have never tried the MSCV. May I ask why do you enable multithreaded option?
because in the manual came from SDL said that we should enable multi-threaded options:
Quote:

Set the C runtime to "Multi-threaded DLL" in the menu: Project|Settings|C/C++ tab|Code Generation|Runtime Library .


but i tried to disable it, and it seems that whether it's enabled or disabled it does not make any difference.
and now oddly enough, the error has reduced to this:
Quote:
LINK : fatal error LNK1561: entry point must be defined

just after i closed and reopened my SDL application, but i still dont know how to fix it. anyone can help??
Try adding
SDL_Init( 0 ); 
somewhere in main(), it could fix it, atleast it did for me when I had a similar error
Link SDLmain before SDL in the linker options and see if it works.

This topic is closed to new replies.

Advertisement