[SDL] Can't use vector push_back with SDL

Glenn McCord clari_player at paradise.net.nz
Tue Aug 1 02:10:43 PDT 2006


Thanks. I've compiled my own SDL and SDLmain and almost got everything 
working. My SDL programs that use .push_back can now compile under 
release mode but not under debug. That is despite using an SDLmain that 
has been compiled as either debug or release. Have I interpreteded what 
you've said correctly?

The error is

Error    1    error LNK2019: unresolved external symbol 
__imp___CrtDbgReportW referenced in function "public: __thiscall 
std::_Vector_const_iterator<int,class std::allocator<int> 
 >::_Vector_const_iterator<int,class std::allocator<int> >(int *,class 
std::_Container_base const *)" 
(??0?$_Vector_const_iterator at HV?$allocator at H@std@@@std@@QAE at PAHPBV_Container_base@1@@Z)    
main.obj   


Is there a way around or am I just going to have to live with it?

Thanks for helping me get this far.

Glenn



Peter Mulholland wrote:

>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.
>
>
>_______________________________________________
>SDL mailing list
>SDL at libsdl.org
>http://www.libsdl.org/mailman/listinfo/sdl
>
>
>  
>





More information about the SDL mailing list