Compiling CUDA without a CUDA project

Dear All

I have a Microsoft Foundation Classes program and I want to include CUDA on it. It is not a CUDA project (obvious). Can you give the procedure, the libraries to include etc? Or some example project of Visual C++ that do it?


Luis Gonçalves

Add to your VC directories:


C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\Lib\x64



C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5\include

…replacing the CUDA version as appropriate.

Then in your code:

#include “cuda.h”


#include “nvcuvid.h”

…if you use CUVID.

Then link in cuda.lib and nvcuvid.lib if you use CUVID.

Report any issues you run into and we will try to help you.

First problem.

As I said I am joining a Microsoft Foundation Classes program with a C program with CUDA.

I done all the above but the C program with CUDA has CUDA asm instrucions like:

asm(“cvt.sat.u8.s8 %0, %1;” : “=r”(res) : “r”(vi));

that Visual Studio 2015 gives - Syntax error : ‘:’

How I define the asm function from CUDA in Visual Studio 2015? Or how I solve the above problem?


Luis Gonçalves

Did you make a build rule to properly compile that file with nvcc? You can’t compile it with the VS compiler.

No, I did not. I understand what you mean. Can you give me a pointer for the procedure, please?

Right click on the source file in Solution Explorer and select Properties. Then set it up for Custom Build Tool. Configure the Command Line to be the nvcc command line you want to use. Etc.