Visual Studio Linker Errors
Suppose you are trying out some program with Visual Studio and you get following Linker Errors (Full Error posted so that google will index it, and thus, it may help many more others who are facing the same problem)
msvcprtd.lib(MSVCP80D.dll) : error LNK2005: "public: __thiscall std::basic_string
msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: __thiscall std::basic_string
The easiest way to solve it is to do this. Check somename.lib. It would be compiled with a different threading library. To check the threading library, do the following:
1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
2. Click the C/C++ folder.
3. Click the Code Generation property page.
4. Modify the Runtime Library property.
If the Runtime Library is set to /MT change it to /MD and vice-versa. Basically, the idea here is that the library of somename.lib must the same as the one you are currently using in your program.
Now, what puzzles me is that i need to build a program and link it with threading library. Why are there so many versions making life difficult for me ? Why not just give -pthread and be done with it as we do in *ix systems ? Does anyone have any idea about this ?
Tags: Visual Studio, Microsoft
Posted by Shyam Krishnaswamy at 1:43 AM