Hamid Hoseini
Hamid Hoseini

Reputation: 133

Visual Studio error "LNK2019: unresolved external symbol"

I get this error in my program. I don't know what that means. can you help me ?

Error 3 error LNK2019: unresolved external symbol imp_CrtDbgReportW referenced in function "public: class std::_Vector_const_iterator > > & __thiscall std::_Vector_const_iterator > >::operator+=(int)" (??Y?$_Vector_const_iterator@V?$_Vector_val@U?$_Simple_types@PAVCommissionEmployee@@@std@@@std@@@std@@QAEAAV01@H@Z) C:\Users\Dell\Documents\Visual Studio 2012\Projects\Base-Commission Employee\Base-Commission Employee\main.obj

Upvotes: 3

Views: 14840

Answers (2)

Leo Chapiro
Leo Chapiro

Reputation: 13984

Take a look here please:

The vector class is going to want to tell you that the at() method failed in debug mode. Thus the reference to CrtDbgReportW(), the runtime function that displays diagnostics while debugging. When you link with /MD, you link with the release version of the run-time library; the one that doesn't tell you anything and is missing the CrtDbgReportW() export. Thus the linker error.

You can fix this by removing the _DEBUG define from the preprocessor definitions. If you don't want to lose that valuable tool, tell us what goes wrong when you link with /MDd.

Upvotes: 10

Andrey
Andrey

Reputation: 11

If you are building a debug version with a static CRT linking (/MT) then just do this: #define _ITERATOR_DEBUG_LEVEL 0 before#include<vector> or #include<algorithm> and so on...

Upvotes: 1

Related Questions