[SDL] Can't use vector push_back with SDL

Peter Mulholland darkmatter at freeuk.com
Sun Jul 23 18:47:53 PDT 2006


Glenn McCord wrote:
> I don't know why it wasn't linking to SDLmain before but it is working now.
> So now I've explicitly linked to the two SDL libraries and removed the 
> two unnecessary headers. However if I go
> 
> /NODEFAULTLIB:msvcrt.lib at Linker -> Command Line -> Additional Dependencies 
> 
> 
> I go from 2 errors to 22. The first few are
<snip>

First thing to do - compile your own SDLmain, VS2005 has changed things 
quite a bit versus the older compilers that the precompiled binaries 
use. Better still, build your own SDL too. This will minimise CRT 
runtime clashes.

I would just build SDL in release mode, but build SDLmain in both 
release and debug modes. Then, use the appropriate version. The reason 
is that the CRT runtime libs used are different in debug and release 
builds, and the linker will moan if they don't match.

That should make all of the problems go away. It's strange though, why 
you were getting errors using vector::push_back(). That would sound like 
Visual C++ has not automatically linked to the C++ runtime lib. Again, 
compiling your own SDL and SDLmain should stop this.

Pete.





More information about the SDL mailing list