SDL problem with collision

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

SDL problem with collision

Post 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:
TorteXXX
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: SDL problem with collision

Post 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)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: SDL problem with collision

Post by Vortex »

Thats it ! thank you, may i ask for curiousity why it suddenly have to be in debug?
TorteXXX
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: SDL problem with collision

Post 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.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Vortex
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 70
Joined: Sat Nov 15, 2008 1:00 pm

Re: SDL problem with collision

Post by Vortex »

ahh thanks alot :)
TorteXXX
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: SDL problem with collision

Post 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!)
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
Post Reply