How to Fix Visual Studio 2012 error LNK2019: unresolved external symbol \"__declspec(dllimport) public: class std::basic_string?

十年热恋 提交于 2019-12-05 01:15:21

In properties->c/c++->Laguage, I set treat wchar_t as built in type to No and it solved my problem.

If you have already tried below options:

  • Updating the EXE project by manually adding references to static lib projects on which the exe project depends
  • Toggling the "treat wchar_t as built-in type" option

Try configuring your project to x64 by following steps:

  • Right click on Solution 'ProjectName'
  • Select Configuration Manager...
  • Change the platform of the project which you are trying to link .lib file to x64 from Win32 (or vise versa)
  • Rebuild the solution

This actually resolved my problem. I wasn't aware if my external lib is compiled for 32-bit or 64-bit.

Even I faced this type of errors in visual studio. The reason for these kind of errors are,

1) You might have included multiple libraries which are conflicting each other. Sometimes,one class in a library can conflict other class in other library.

2) You might have included libraries from directories. Check the path of the libraries once again.

3) You need to specify libraries and header files (if you have to include) in the project properties. Check once again whether the paths are correct.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!