I've recently purchased the CUDA C By Example book, and I'm trying to get setup. I downloaded the toolkit and am trying to run this bit of simple code:
#include <stdio.h>
__global__ void add(int a, int b, int * c)
{
*c = a + b;
}
int main(void)
{
printf("Hello World!");
return 0;
}
The errors I'm getting are:
expected '(' to follow '__global__' line 2
'add' not in formal parameters list line 3
syntax error: missing ';' before '{' line 3
expected a ';' line 3
Not sure what I'm doing wrong. Is there some #include statement that I'm missing? The book did not include one, and the examples I've read online don't seem to have another one either. For a bit more info, I made a Visual C++ project in Visual Studio, and made the file have a '.c' extension vs '.cpp'.
Any help would be appreciated, I really want to start working with this stuff :D