Cuda obj file in VC++ Project causes failure

I’m a beginner, so I might have a misunderstanding of how to use Cuda in VC++.

Here’s what I’m doing:

I have a simple test.cu file, with one empty function to test.

I compile it with: nvcc -c test.cu

It compiles correctly and generates test.obj

I add test.obj it to my VC++ project.

It compiles correctly, with no warnings or errors.

But as the program starts, it halts producing this error:

.......

'MyProgram.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll'

'MyProgram.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll'

'MyProgram.exe': Loaded 'C:\WINDOWS\system32\rsaenh.dll'

'MyProgram.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4148_

x-ww_d495ac4e\msvcm90.dll'

First-chance exception at 0x7c96e478 in MyProgram.exe: 0xC0000005: Access violation reading location 0x6b5b92ad.

First-chance exception at 0x7858ce29 in MyProgram.exe: 0xC0000005: Access violation writing location 0x6b5b92ae.

First-chance exception at 0x7c812afb in MyProgram.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.

Additional information: The type initializer for '<Module>' threw an exception.

Anybody have any ideas? Thanks!!

I’m a beginner, so I might have a misunderstanding of how to use Cuda in VC++.

Here’s what I’m doing:

I have a simple test.cu file, with one empty function to test.

I compile it with: nvcc -c test.cu

It compiles correctly and generates test.obj

I add test.obj it to my VC++ project.

It compiles correctly, with no warnings or errors.

But as the program starts, it halts producing this error:

.......

'MyProgram.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll'

'MyProgram.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll'

'MyProgram.exe': Loaded 'C:\WINDOWS\system32\rsaenh.dll'

'MyProgram.exe' (Managed): Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.4148_

x-ww_d495ac4e\msvcm90.dll'

First-chance exception at 0x7c96e478 in MyProgram.exe: 0xC0000005: Access violation reading location 0x6b5b92ad.

First-chance exception at 0x7858ce29 in MyProgram.exe: 0xC0000005: Access violation writing location 0x6b5b92ae.

First-chance exception at 0x7c812afb in MyProgram.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000..

An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module.

Additional information: The type initializer for '<Module>' threw an exception.

Anybody have any ideas? Thanks!!