How to compile a simple example for the driver API?

Hello everyone,

i’ve got a problem - i wrote a simple program to use the CUDA driver API and i just wanted to check if it works:

[codebox]#include <cuda.h>

int main() {



(reduced it to the essence, if i get this one working, the rest will do it too :-) )

So, how do i compile this bit of code using nvcc or gcc under Windows?

if i simply try:

nvcc test.c

or nvcc -I"C:\CUDA\include" -I"C:\CUDA\lib" test.c

it gives me a LNK1120 (unresolved externals) error, even if i include the CUDA_INC and LIB directories.

Maybe i’m just to blind to see or to bad at C to see the solution, so could anyone please help?

Thanks for your input :-)

I think that you need to link with cuda.lib, -lcuda in Linux or cuda.lib in windows