[SDL] compile error under vc++ - unresolved external symbol
Peter Mulholland
darkmatter at freeuk.com
Sat Jul 15 22:06:35 PDT 2006
Albert Ridolfi wrote:
> Hello Peter,
>
> I was using the pre-compiled libraries, but now I have built them all by
> myself, and this didn't fix the problem.
>
> I modified just the main function and the signature, and removed #include
> "stdafx.h", now it is just int main()
How have you created the project ? The correct setting to use is "Win32
Project", "Windows Application", and IMHO you are best ticking "Empty
Project"
One thing I have noticed is that VS2005 now defaults to using Unicode
character set. I doubt this is a problem but you can always try setting
it back to Multibyte (the default in previous versions), in the project
property pages under General.
> The compiler output:
> main.obj : error LNK2019: unresolved external symbol _Mix_LoadWAV_RW
> referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)
> main.obj : error LNK2019: unresolved external symbol _SDL_RWFromFile
> referenced in function "int __cdecl SDL_main(void)" (?SDL_main@@YAHXZ)
I don't get this. These should be available if you are linking with
SDL.lib and SDL_mixer.lib. For some reason VS2005 is not doing so. Are
you sure that the place where these lib files are is in VS2005's library
search path?
> MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main
> referenced in function ___tmainCRTStartup
That means that the wrong project setting (Console Application most
likely, in Unicode mode) was chosen.
Windows Apps typically have a WinMain() entry point. SDL hides this
through SDLmain.lib so that it can set itself up, and it makes it appear
that a standard main() is supported. This shows up (through some
preprocessor tricks) as SDL_main().
Pete.
More information about the SDL
mailing list