Hi everyone. This is quite a basic question but im struggling.
I have a .cpp file with a main function and i am calling a function that sets up GPU (allocates memory etc) - however this function is in its own file.
//main.cpp
int main()
{
set_up_gpu();
return 0;
}
File: gpu.cu
//gpu.cu
void set_up_gpu()
{
cudaMalloc() // balh blah blah
cudaMemcpy() // blah blah blah
callKernel() // etc etc
}
HOWEVER, i have no idea how to deal with the header files to point to this function in main.cpp. What i have done is: i have a GPU.h that has a decleration for set_up_Gpu()
and the main has
#include “GPU.h”
BUT im getting errors! Its not executing. - ERROR LNK2005
If anyone could tell me how to structure the headers so that it compiles it would be great!!!
Thanks in advance.