Linking Compiled CUDA Object into MinGW GFortran Works on Linux but getting link errors in Windows 7

I have a simple example program that demonstrates how to call CUDA-C code from a Fortran module. This compiles, links, and runs properly on my Linux system. However, when I attempt to port it to Windows 7, I get a strange link error (see below).

Here are the commands I am calling (with output). My CUDA code is in and the Fortran code is in test.f90.

nvcc -o my_func.o -c





gfortran -c test.f90

gfortran -o test my_func.o test.o "-LC:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\Win32" -lcudart

Warning: .drectve `/DEFAULTLIB:"libcpmt" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized

my_func.o:(.text+0xa): undefined reference to `__security_cookie'

my_func.o:(.text+0x1b7): undefined reference to `@__security_check_cookie@4'

collect2: ld returned 1 exit status

mingw32-make: *** [all] Error 1

My research suggests that the problem is due to the fact that GFortran is running under MinGW, but nvcc is using Microsoft Visual Studio (cl.exe) as the C compiler. I have also read that it is impossible to use MinGW’s gcc as the nvcc C compiler.

So that leaves me at a dead end. Any assistance would be greatly appreciated.

Also, if you do not have a solution, but could help me restate or elaborate on my problem in a way that would help me research this issue, that would be appreciated as well.