After 2 years, I finally found the solution in my case.
In CodeBlocks, under Project > Build Options > Compiler Flags, remove Multi-threaded DLL Runtime Library [/MD] and rebuild.
Domanda
I know there's a lot of question like this one, but no one of those answers help me to solve my problem. What problem? Well, when linking, after compiling my project I receive this:
fatal error LNK1104: cannot open file 'MSVCRT.lib'
I'm using CodeBlocks under Windows 8 64-bit. Compiling with the Visual C++ 2003 Toolkit compiler, which I have installed under C:\Program Files (x86)\Visual C++ 2003 Toolkit
and using a lot functions from the Windows API, which I also have installed under C:\Program Files (x86)\Windows Kits
).
Searching on the internet I found some solutions like to link this library (MSVCRT.lib
) under my project settings, but I definitely don't have that file. This is a project (the one in which I'm receiving this error) that I was working on about 15 days ago, and now I want to resume its development. I compiled and linked this project a lot of times, and I never got this linker error, I don't know why now I just can't link it.
Some solutions say I need to install VS.NET so the MSVCRT.lib
file will be there, but I never had that installed and I was able to compile and link my project!
Any ideas on how can I solve this without installing VS.NET (also, I don't know if this is going to work)?
Soluzione
After 2 years, I finally found the solution in my case.
In CodeBlocks, under Project > Build Options > Compiler Flags, remove Multi-threaded DLL Runtime Library [/MD] and rebuild.
Altri suggerimenti
What just did it for me, was to delete the .sdf and .suo files.
I just ran into this using Visual Studio 2017. After trial and error, I discovered that if I put an empty or blank value in the Linker --> Input section, it would give me the error about LNK1104: cannot open file 'MSVCRT.lib'. Eventually I figured out that I should leave this value there instead.
On the Visual Studio project, right-Clicking on the project item in the Solution explorer panel (not the Solution itself, which is the topmost item), then select Properties. From there do the following:
Linker --> Input : %(AdditionalDependencies)
This additional information might be helpful, if you got into the situation the same way I did. I was trying to compile with external .lib files. Previously I had a value in this input section like: $(ProjectDir)lib; %(AdditionalDependencies) but this lead to other problems and eventually I moved that value into:
VC++ Directories --> Library Directories : $(ProjectDir)lib; $(LibraryPath)
Note the $(LibraryPath) value will include extra values such as inherited from parents. My folder project contained a folder called 'lib' which is why I had the first value there before the semicolon.
Follow this -> Integrating Microsoft Visual Toolkit 2003 with Code::Blocks IDE
From there
If the project you are compiling complains that it cannot find "msvcrt.lib" then download the .NET 1.1 SDK and add to the END of the Directories->Linker tab:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\lib