Jump to content
  • Advertisement
Sign in to follow this  
absolute

Vector / Run Time Library Question

This topic is 3764 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When I compile this code it compiles fine when using the Runtime Library Multi-threaded Debug DLL (/MDd). vector<double> marks; marks.resize (5); However when I compile it using the Runtime Library Multi-threaded DLL (/MD), I get the error "fatal error LNK1120: 1 unresolved externals". Is this because the vector-marks isn't initialized to anything? And if so is there any way to resize an unitialized vector without getting the error? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I may well be wrong, but it doesn't look to me like an error caused by an uninitialised variable. In any case, I imagine that vector has a default constructor that handles any appropriate initialisation.

What external does the error claim is unresolved, and in what file?

Share this post


Link to post
Share on other sites
tile.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: class std::vector<int,class std::allocator<int> > & __thiscall std::vector<class std::vector<int,class std::allocator<int> >,class std::allocator<class std::vector<int,class std::allocator<int> > > >::operator[](unsigned int)" (??A?$vector@V?$vector@HV?$allocator@H@std@@@std@@V?$allocator@V?$vector@HV?$allocator@H@std@@@std@@@2@@std@@QAEAAV?$vector@HV?$allocator@H@std@@@1@I@Z)

C:\Testing\Grid\Debug\Grid.exe : fatal error LNK1120: 1 unresolved externals

This is the exact error.

Share this post


Link to post
Share on other sites
Hmm... So, it appears that it's missing the item "__imp___CrtDbgReportW". Judging by the name, it looks like it's related to debugging.

The problematic reference would seem to be in tile.obj, which leads me to think that something in tile.obj is still referencing debugging information, my guess being that it's linking to a debug library somewhere.

Are you sure that you're not linking to another debug library somewhere?

If so, have you tried running a clean, thus forcing the re-build of tile.obj, hopefully with only release-mode libraries?

Share this post


Link to post
Share on other sites
I've tried rebuilding and cleaning, but I still get the error. How can I check that I'm not linking to another debug library somewhere?

Share this post


Link to post
Share on other sites
Well, you should somewhere (depending on your compiler) have a listing of the libraries and the like that you link to.

In Visual Studio 2005, for example, you can find a list of linked-to .libs by going to Project-><project_name> Properties, expanding "Linker", and selecting "Command Line" - in the results produced in the right-hand panel you should see a series of .lib files. Look for ones that appear to be debug files (they might end in "_d", before the extension, of course, for example). If you're unsure, you should be able to look up individual files online.

There may be a better way (including options to check) - I'm afraid that I only recently switched up from Visual Studio 6. ^^; Given this, I defer to forum members with more experience in such matters.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!