Let’s say I have 3 files: test.c, test.h and test_kernels.cu. I’m also using Code::Blocks with all the nvcc setup requirements.
I have a function: void cuda_setup(int x) initialized in test.h, declared in test_kernels.cu and referenced in test.c . Everything compiles fine BEFORE I put in the reference into test.c but after I call the function I get an ‘undefined reference to cuda_setup’ error. test_kernels.cu IS being compiled into an object and if I plant an error in test_kernels.cu the compiler complains. However, if i copy/paste cuda_setup(int x) into test.c (or even a fourth file) everything compiles and links fine.
ARgh, this is frustrating. I can’t figure out what is wrong. I’m actually building on another person’s project and their code is split across 20+ .c files. I can put cuda_setup() into any other file and it works fine. It’s only ignored when it’s defined in test_kernels.cu. Any ideas why? Help would be saintly.