Compiling C++ Program Causes “Fatal Error LNK1104”

有些话、适合烂在心里 提交于 2019-12-17 20:51:56

问题


I am trying to compile a c++ application using the following command in command prompt:

cl -I"c:\Program files\Java\jdk1.5.0_07\include" -I"c:\program files\java\jdk1.5.0_07\include\win32" -MD -LD HelloWorld.cpp -FeHelloWorld.dll

However, this produces the following error:

LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'

Have you any ideas of what is causing this and how to fix it?

I have visual studio 2005 installed on windows.

Thanks,

-Pete


回答1:


LINK : fatal error LNK1104: cannot open file 'MSVCRT.lib'

Any ideas of what is causing this and how to fix it?

The linker needs to be pointed to the location of MSVCRT.lib, as it doesn't seem to be in your LIBPATH.

It should be here: C:\Program Files\Microsoft Visual Studio 7\VC\lib

Add -link -LIBPATH:"C:\Program Files\Microsoft Visual Studio 8\VC\lib"




回答2:


To Solve this Problem in MS Visual studio 2008.

  1. Goto Menu Project->Properties (Alt+F7)
  2. Configuration Properties
  3. Linker -> General -> additional Library Directories -> C:\Program Files\Microsoft Visual Studio 9.0\VC\lib

....do the above steps and enjoy




回答3:


In the command prompt run the following command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

Then work in the same command prompt.



来源:https://stackoverflow.com/questions/927574/compiling-c-program-causes-fatal-error-lnk1104

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