Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LINK : fatal error LNK1104: cannot open file 'libcpmt.lib' after manually configuring the LIB environmental variable

I'm trying to use the cl Visual Studio 2010 compiler from the command line.

For some reasons, my installation of Visual Studio 2010 is not able to correctly configure the INCLUDE and LIB directories, see Yet another post on fatal error C1034: no include path set. If I run

`vcvars32.bat`

I receive the following error message:

ERROR: Cannot determine the location of the VS Common Tools folder.

I then tried to set these environmental variables manually. So I created a simple bat file as follows:

Set INCLUDE="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;"

Set LIB="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;"

cl test.cpp

but I now receive the following error

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

I do not understand why this happens, since libcpmt.lib is inside one of the above LIB directories.

Any solution to this problem?

EDIT

I used the procedure in the first answer to VS2010 command prompt gives error : Cannot determine the location of the VS Common Tools folder and now the VS100COMNTOOLS environment variable is set. But the INCLUDE and LIB environment variables are still not set, even if I try to set them manually by

set INCLUDE = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;"

set LIB = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;"

Accordingly, when I try to compile the .cpp file I receive

fatal error C1034: iostream: no include path set

EDIT: FINAL SOLUTION

Following Hans Passant's suggestions, this is the final solution

@SET INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include;

@SET LIB=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Lib;

cl /EHsc -o FileName.obj -c FileName.cpp
like image 692
Vitality Avatar asked Sep 19 '13 09:09

Vitality


1 Answers

Get rid of the double quotes.

The real problem is that the VS100COMNTOOLS environment variable isn't set. You'll need to find out why the environment got messed up like that. Control Panel + System + Advanced + Environment variables. Or use the VS setup repair option. Logout + Login after making changes.

like image 136
Hans Passant Avatar answered Sep 29 '22 13:09

Hans Passant