8

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
Community
  • 1
  • 1
Vitality
  • 20,705
  • 4
  • 108
  • 146

1 Answers1

4

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.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Thank you very much for your answer. I have made a step forward to solve the problem, see my edited post, but I still cannot compile from the command line. Any further help would be _very_ appreciated :-) – Vitality Sep 19 '13 at 21:14
  • No idea what that edit is supposed to show, you are still using double quotes so of course it still won't work. Have you considered just using the IDE instead? It was made to keep you from getting stuck on little details like this. Recommended. – Hans Passant Sep 19 '13 at 21:33
  • Thanks for your comment. It is a known bug of Visual Studio 2010 not to be able to create static `lib`s for CUDA codes, so I'm forced to use the command line to make `nvcc` compilations. I have a library mixing CUDA and C/C++ code, therefore I'm trying to use the command line for both. I have tried to use the IDE for the C/C++ part, but I have linking problems. I using the `Set` command with or without double quotes, but I'm not able to set the `INCLUDE` and `LIB` environment variables... – Vitality Sep 19 '13 at 21:52
  • Sure. It is not a bug, it is intentional. To keep programmers from using a library that requires the programmers that use it to be in the "really-knows-what-he's-doing" category. And you *definitely* need to know what you're doing when you use Cuda, keeping 256 cores humming is not a trivial undertaking. So they make it intentionally hard to get started. It's a gauntlet, they made you fail on purpose. – Hans Passant Sep 19 '13 at 22:05
  • 1
    Thank you very much. Following your suggestions, I have finally found a solution. I have edited my post for future references. Thanks again. – Vitality Oct 09 '13 at 07:43