Calling .cu file functions from .cpp file

I am using visual studio 2015 Community with CUDA 8. The samples worked properly. However, I am having issues with getting my own code/projects to work. Both files in question (.cu and .cpp) are in separate projects. Both projects compile and run properly as long as I don’t include the .cu file in the .cpp file. If I do, I get the following errors upon attempting to build a solution:

Error C3861: ‘__syncthreads’: identifier not found
Error C3861: ‘__syncthreads’: identifier not found
Error C2059: syntax error: ‘<’
Error C2059: syntax error: ‘<’

Both “pairs” of errors originate from the same line of code, respectively. The latter comes from the <<<num blocks, num threads>>> syntax.
The same results occur (under the same circumstances) when both files are in the same project.

Help would be appreciated,

There is no reason to include a .cu file in a .cpp file, and doing so is almost certainly a bad idea. By this I mean don’t put this in your .cpp file:

#include “”

You should be able to have a .cpp file and a .cu file in the same project with no issues. There are many CUDA sample projects which demonstrate exactly this.

Take a look at the cppIntegration sample code.

Alright, thank you!