Reputation: 399
How can I force GCC to compile with threadIdx lines in my code?
I'm attempting to compile my cuda application with a c wrapper.
To generate the .so file I run: nvcc -arch=sm_11 -o libtest.so --shared -Xcompiler -fPIC main.cu
Then I attempt to compile the c wrapper with: gcc -std=c99 -I/usr/local/cuda/include -o main -L. -ltest main.c
This results in the following error a few layers down in my code(an include to an included file): error: ‘threadIdx’ undeclared
Note: Everything does compile and run just fine as a GPU application without any C wrapping.
Upvotes: 0
Views: 936
Reputation: 544
Gcc has no capability to compile the cuda part of the code. You need nvcc to compile the code. gcc does not know what to do when it came across threadIdx is.
Upvotes: 1