CUDA 5.5 and user-defined types (classes) - how to get it done correctly.

Hello everyone,

A few days ago I’ve started learning CUDA and I am new to the GPU programming in general.
I’ve managed to skim through the book “CUDA by Example” to get an idea.

Currently I have a working Raytracer (C++ and SDL). What I want to do is to make it a GPU-based raytracer.

I have written my Vector class in order to try it out if all the operations work - but here is where I am stuck. There is the code:

Vector.h : http://pastebin.com/xZveW70f
Vector.cpp: http://pastebin.com/F55G8bnq
main.cpp: http://pastebin.com/sFUSQuU1
test.cu: http://pastebin.com/KarEVFE6

It fails to compile test.cu and it is giving me: error MSB3721: “…blabla.” exited with error code 2
However, if I leave the vectorOperations() kernel empty it compiles without problem.
So I guess the problem must be something with the operator overloaded functions for my Vector class.

I want to note that I have no problem with running simple kernels (with fundamental data types).

I am not sure if it’s possible to call overloaded operator functions with user defined data types and I would highly appreciate if you could give me any tips about how to make the architecture of my GPU raytracer.

OS: Windows 8.1 x64
IDE: Visual Studio 2012

Regards,
Peter