Skip to main content
GameDev.net gamedev.net
🔒 Locked 🤖 Godot

Insane linker problems

Started by Daniel Miller Jan 18, 2005 at 7:28 PM 7 replies 2.2k views
Original Post
Daniel Miller
Daniel Miller
To start things off, I'm using VC 2005 Beta. Whenever I try to use a vector in a function, I get a linker error (LNK2019 or sometimes LNK2009). Here my code (it is as small as I can make it)

#include <SDL/SDL.h>
#include <vector>

void f()
{
        std::vector<int> v;
        v.clear();
}

int main (int argc, char* argv[])
{
        return 0;
}





It was working fine until I tried to use vectors. Any idea what the problem could be? (Here is the exact error)
main.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: void __thiscall std::_Vector_const_iterator<int,class std::allocator<int> >::_Compat(class std::_Vector_const_iterator<int,class std::allocator<int> > const &)const " (?_Compat@?$_Vector_const_iterator@HV?$allocator@H@std@@@std@@QBEXABV12@@Z)

[Edited by - Daniel Miller on January 18, 2005 8:31:05 PM]
DarkMerchant
DarkMerchant
first i would try to #include namespace std; or at least use a using std::vector; if these don't work after a rebuild, google it.
Daniel Miller
Daniel Miller
Thanks for your reply.

That doesn't work, though, and I have googled it. I also know it isn't a problem with my specific set up because my friend got the same error on a different computer (but also with VC 2005 Beta).
lucky_monkey
lucky_monkey
I Googled for "CrtDbgReport" and came up with a couple of interesting sites. It looks like it might be something to do with debug libraries or something...
chollida1
chollida1
Link with the dll version of the C++ runtime, msvcrt.dll, I believe

Cheers
Chris
CheersChris
Daniel Miller
Daniel Miller
Thanks all for your replies!

I'll check these things out right now. :)
Daniel Miller
Daniel Miller
I'm sorry for the late response, I hadn't had access to this specific computer. However, I did test it on VC2003.NET, and it compiled. When I tried to link 2005 to msvcrt.dll, it said the file could not be opened? Any ideas?
Brendan Bond
Brendan Bond
What you could do is download the Visual C++ Toolkit 2003 (free from Microsoft) and replace the 2005 compiler with that... I know it seems a bit extreme, but it might be worth it to use std::vector : ).

-Brendan Bond
Brendan Bond
Daniel Miller
Daniel Miller
Quote:
Original post by Brendan Bond
What you could do is download the Visual C++ Toolkit 2003 (free from Microsoft) and replace the 2005 compiler with that... I know it seems a bit extreme, but it might be worth it to use std::vector : ).

-Brendan Bond


Thanks for the response.

I guess I could, but then again I could just go ahead and use the original VC2003.

It's now become one of those things that HAS to be solved, if you know what I mean. :P

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.