user2521472
user2521472

Reputation: 137

CUDA + Visual Studio 2013

Is there a way to have more than one .cu file in your VS2013:Community Edition project?

Let's say I have a main.cu which serves as application's entry point and some class.cu which holds implementation of some class' methods - is it possible to compile this?

Right now I have a project which looks exactly like this and I get errors from Thrust which look like the ones people normally get when they try to compile their code with just g++/microsoft's compiler and everything works fine if I just put everything in one .cu - which means code itself is not a problem.

My CUDA installation is not the problem either since I can compile the examples just fine in VS and if I use nvcc.exe -c class.cu main.cu to compile my own project then it works just fine and I get the .exe.

The forementioned error that I encounter in VS is:

Error   2   error C2027: use of undefined type 'thrust::detail::STATIC_ASSERTION_FAILURE<false>'    

Any ideas? Thanks in advance.

Upvotes: 2

Views: 1502

Answers (1)

user2521472
user2521472

Reputation: 137

Robert's answer contributed greatly to me solving this problem - to be more precise it was his statement that " Each file can possibly have it's own settings, which could be causing your class.cu file to behave differently, depending on how you added it to the project. ".

In the end all I had to do was go to class.cu's properties and in the "general" tab change the item type field to CUDAC/C++ - it was set to regular C/C++ by default.

Now it compiles and runs in VS2013 without any problems.

Upvotes: 3

Related Questions