Public Group

# Vector / Run Time Library Question

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

## 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 on other sites
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 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 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 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 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.

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 12
• 9
• 12
• 37
• 12
• ### Forum Statistics

• Total Topics
631419
• Total Posts
2999986
×