Calling kernel from c++ project

Hey there,

I’ve been puzzling for quite a while on how to call and run a kernel from a C++ application. Basically what i would like to have is a main.cpp looking like:

#include ""

int main()





And then have a file that says something like:

__global__ void simpleKernel()


  //Perform calculation on device.


void simpleHost()


  simpleKernel<<<x, y>>>();


The problem is, as soon as I have the main function in a separate file that gets compiled by my Visual studio compiler as a regular c++ application i run into syntax errors because now the compiler also checks the syntax of even though the latter is set to use a custom build rule. Excluding from the build wouldnt work. Visual studio still prints syntax errors due to the <<< for example.

Note that i set up the project correctly to use nvcc for the It actually does compile and run fine when i move the main() function into and delete the main.cpp from the project. But thats not what i want to be working with.

Nevermind, I just found out about the cppIntegration sample project file in the sdk. Should work out for me.