Compiling with gfortran and nvcc

Hi,

I’m trying to call a CUDA function written in C from a program written in Fortran. I’m pretty certain that all the code is ok, but I’m having trouble pointing the gfortran compiler at the cuda library files. I think it’s to do with the fact that gfortran’s -l option looks for *.a files rather than .lib files…

Here are the commands I use to compile:

nvcc -c -O3 kernel_wrapper.cu

gfortran -c Fortran_C_Interface.f95

gfortran -L$(CUDA_LIB_PATH) -lcudart -lcuda -I$(CUDA_INC_PATH) Fortran_C.f95 kernel_wrapper.obj

Where CUDA_LIB_PATH = C:\CUDA\v3.2\lib\Win32; CUDA_INC_PATH = C:\CUDA\v3.2\include

The first two commands work as expected. However, the last command spits out the following error:

c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lcudart

c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/ld.exe: cannot find -lcuda

collect2: ld returned 1 exit status

How do I point gfortran at .lib files? Or do I have to process the .lib files into .a or .o files first? Or have I got the syntax all wrong seems as I’m using Windows XP (32 bit) and not Linux?

Any help would be greatly appreciated :)