CUDA and CPP

Hi Everyone,

Why is it that in CUDA under linux, I can freely mix C++ code with cuda code, but in VS2005, I’m not allowed to do this? Is there a way to overcome this? I have a lot of code that was already written under linux, and I don’t want to have to rewrite it for a windows port. Thanks for the help!

Cheers,

Paul

But you can freely mix C++ and cuda code in VS2005, I do it all the time. Just compile the C++ code in .cpp files, the cuda code in .cu files and link it all together. CMake combined with FindCUDA.cmake can do all this automatically for you.

Or, are you trying to use C++ code inside a .cu file compiled by nvcc? For that, you will probably need to change the host-compilation command line option to NVCC: see the release notes for CUDA 1.1. Note that the release notes state that this is a “pre-alpha” feature so don’t be surprised it if doesn’t work or blows up.