0

I was attempting to load an image and I received this error:

Error   1   error LNK2019: unresolved external symbol __imp___CrtDbgReportW
referenced in function "public: char const & __thiscall
std::_String_const_iterator<class 
std::_String_val<struct std::_Simple_types<char> > >::operator*(void)const " 
(??D?$_String_const_iterator@V?$_String_val@U?$_Simple_types@D@std@@@std@@@std@@QBEABDXZ)   
C:\Users\Name\Documents\Visual Studio 2012\Projects\ConsoleApplication4\
ConsoleApplication4\Terrain.obj

I've checked the MSDN forum and tried solve the problem by removing _DEBUG from the preprocessor/ add /MTd to the command line, but neither proposed solutions worked.

I've narrowed the problem down to the ImageLoader class, but have no idea on how to resolve the issue... I've been following THIS tutorial, which supplies the Image loading class.

Any suggestions as to how to resolve this error?

  • 3
    You are mixing code compiled with different compile options. To resolve this link error you will at least need /MDd, /MTd cannot work. Best thing to do is to carefully review all projects that you link, possibly having to recompile a .lib that you got elsewhere. – Hans Passant Jan 24 '13 at 14:05
  • @HansPassant Thanks for the input. /MDd solved the error, but now I have Unhandled exception at 0x1000BB1E (glut32.dll) in ConsoleApplication4.exe: 0xC0000005: Access violation reading location 0x00000070. –  Jan 24 '13 at 21:02
  • 1
    @SpicyWeenie If you're linking in other dependencies then one of the other dependencies may still have been compiled with /MD. So at runtime, the entry point for a C-runtime function may be incorrect. All dependencies have to be compiled to link to the same type of C-runtime library. Otherwise you're likely to encounter Access violations or other such errors. This might give more information... http://stackoverflow.com/questions/746298/how-do-you-build-a-debug-exe-msvcrtd-lib-against-a-release-built-lib-msvcrt – buzz3791 Apr 16 '14 at 17:13

0 Answers0