Page 1 of 1

SDL problem with collision

Posted: Mon Jan 19, 2009 12:01 pm
by Vortex
hello again, im learning sdl from lazyfoo´s tutorials, now i have came to collision ( per-pixel collision )
but i encounter a problem,
i have tryed to solve this on my own but i really cant figure out whats wrong
so i tryed to compile the source from his website and i get the same problem so it have to be something wrong with my compiler cause it compiled fine before this tutorial!

heres the wrong message:

Code: Select all

1>Linking...
1>main.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: struct SDL_Rect & __thiscall std::vector<struct SDL_Rect,class std::allocator<struct SDL_Rect> >::operator[](unsigned int)" (??A?$vector@USDL_Rect@@V?$allocator@USDL_Rect@@@std@@@std@@QAEAAUSDL_Rect@@I@Z)
1>C:\Users\Timmy\Documents\Visual Studio 2008\Projects\SDLGAME\Debug\SDLGAME.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\Timmy\Documents\Visual Studio 2008\Projects\SDLGAME\SDLGAME\Debug\BuildLog.htm"
1>SDLGAME - 2 error(s), 3 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
maybe someone else got the same error on that tutorial, also i use visual studio 2008 express. thanks :bow:

Re: SDL problem with collision

Posted: Mon Jan 19, 2009 2:45 pm
by MarauderIIC
In your project settings somewhere, there's an option that probably currently reads "Multi-Threaded Debug" -- change it to "Multi-Threaded Debug DLL". If that's already like that, the program isn't linking one of the standard libraries of msvcrtd.lib (<-I think that's what it's called) or libcmtd.lib (<-I'm for sure on that one).
Edit: For release builds, use Multi-threaded DLL (and mscvrt.lib and libcmt.lib but those not being built against by default means something bad has happened, same as them not being linked against in debug above :P)

Re: SDL problem with collision

Posted: Mon Jan 19, 2009 3:34 pm
by Vortex
Thats it ! thank you, may i ask for curiousity why it suddenly have to be in debug?

Re: SDL problem with collision

Posted: Mon Jan 19, 2009 3:45 pm
by MarauderIIC
I'm assuming you're compiling in Debug mode. For a release build, use Multi-Threaded DLL (Instead of multi-threaded debug dll)
"DLL" part means that part of your libraries you're linking to (SDL) is a DLL file. If you have the source, the "Multi-threaded" and "Multi-threaded debug" builds what would be a DLL file directly into your .exe.

Re: SDL problem with collision

Posted: Tue Jan 20, 2009 8:47 am
by Vortex
ahh thanks alot :)

Re: SDL problem with collision

Posted: Tue Jan 20, 2009 2:07 pm
by MarauderIIC
You're welcome. That's called "static linking" by the way, when you have no DLL files with your project when you could. It's called "dynamic linking" when you do (because you can update the .dll files and your project will work, but with updated stuff!)