But then what does the ref-man mean when it says:
“The C API (cuda_runtime_api.h) is a C-style interface that does not require compiling with nvcc.”
When I look into the cuda_runtime_api.h, it has all the cuda* functions only.
I think that on windows the runtime API functions are declared assuming C extensions that don’t work with other than MSVC. You’re getting a link error because g++ on cygwin isn’t using those extensions. The driver API assumes less, so I suppose you’d have to use that on windows if you don’t have visual studio.
The following program compiles and runs fine with mingw32:
gcc -o test query.c -Ic:/cuda/include c:/cuda/lib/cuda.lib
but fails in the same way on cygwin, because cygwin doesn’t define _WIN32 and nvidia’s libraries assume declaration with __stdcall. Anyway, your original program has the same link error in mingw32.
Thanks MisterAnderson42 and jasonp! @jasonp: That sounds reasonable. I just used the MSVC cl.exe compiler to compile my program mentioned at the beginning of this post, and yea…!! It compiles the program neatly :)