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

I’m setting up a CUDA development environment but it is being challenging… I installed Visual Studio Professional with x64 compiler tools, CUDA SDK and Notebook Dev Drivers, all 64bit. Also I’m using windows 7 Pro 64bit.

When I try to compile anything it gives the error on the title:

LINK : fatal error LNK1104: cannot open file ‘libcpmt.lib’

Already tried to put this file in the same folder as the .cu and it just asks for more libs. When I put all the libs it asks, it gives another strange error…

My graph card is 9500GS

Any Help?

Seems configuration problem. Fellow the steps below and this issue should be solved:

  1. Set the 64 bit cl.exe in PATH (Since your env is 64 bit, if windows its should be something like this C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64)
  2. Execute vcvars64.bat inside above path ( … \VC\bin\amd6) in cmd. This will temporarily set the required env variables by cl.exe and link.exe
  3. To make settings permanent
    (i) get the values of LIB, LIBPATH, TMP and INCLUDE by executing echo %LIB%, echo %LIBPATH%, echo %TMP% and echo %INCLUDE% in the same cmd window where you executed vcvars64.bat
    (ii) create these 4 environment variables in windows

The problem is that the linker (link.exe) is unable to find the required libraries to produce the .exe from the object files generated by the compiler cl.exe. If above environment variables are not set or screwed up then the linker won’t be able to find them.

However, if your vcvars64.bat itself is screwed up, then probably you need to reinstall VC++ or fix it somehow.

Further reading: