Compiling CUDA on visual C++ 2005 Problem with exceptions?

I used the custom build file I found on these forum.
So now I am able to compile .cu files.
However, I get the following compilation errors:

1>Compiling…
1>ReconstructCUDA.cu
1>“C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\xlocinfo”, line 77: error:
1> support for exception handling is disabled
1> throw runtime_error(“bad locale name”);
1> ^
1>“C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\xlocinfo”, line 87: error:
1> support for exception handling is disabled
1> throw runtime_error(“bad locale name”);
1> ^

And etc.
I have the enable C++ exceptions on Yes in my project, and I can’t find any other important difference from my project to the sample project in which the CUDA code I wrote compiles perfectly.

Thank you.

Even if I put the whole content of the .cu file into /**/, I get these errors.

An update:
Currently my custom build command line looks like this:

nvcc.exe -ccbin “$(VCInstallDir)bin” [Emulation] -c [Defines] -Xcompiler /EHsc,[Warning],/nologo,/Wp64,[Optimization],/Zi,[RuntimeChecks],[Runtime],[TypeInfo],[Include] -o $(ConfigurationName)$(InputName).obj $(InputFileName)

In this case I get:

nvcc fatal : A single input file is required for a non-link phase when an output file is specified

If I do some variations with putting “” around (which I am not sure what they do) then I get the previous errors.
The /EHsc flag is the flag about exceptions, so this may be related to the errors I get with the exceptions.

You might be missing a ‘space’ in one of the parameters you pass to nvcc. I remember making that error and getting the ‘Only one input file’ error you have mentioned.

This problem was due to some changes I did in the command line, but when I have a good command line, with all the options and no extra spaces or ‘,’, then I get the excpetions errors which I don’t know how to deal with.

I have solved the problem, you might be interested in the solution because similar problems may happen with other file names.
The problem was simply that in my code library I had two files: Math.h and Math.cpp.
Apparantly cuda with visual was looking for a math.h, and accidently found my math.h file.
I assume that if cuda have other files, then creating files with the same names as the cuda files will cause the same problem.

Hello,

I have the same Problem, but i could not solve it.

I coppied the ‘template’ (Cuda SDK\projects\template) to another path on my HDD and opend it with my VisualStudio2005.

When i try to compile it, i get the following Buildlog: http://reimund-v.de/Diplom/BuildLog.htm

Could anyone help me please?

Hi,

I faced the same problem. In my case, it was resolved by removing the following piece of code :
#include
#include
using namespace std;

I am yet to figure out why this happens.

i use the following custom bulid command string:

“$(CUDA_BIN_PATH)\nvcc.exe” -ccbin “$(VCInstallDir)bin” -deviceemu -c -D_DEBUG -DWIN32 -D_CONSOLE -D_MBCS -Xcompiler /EHsc,/W3,/nologo,/Wp64,/Od,/Zi,/MTd -I “$(CUDA_INC_PATH)” -o $(ConfigurationName)\example1.obj example1.cu

then remove the #include “stdafx.h” from example.cu source file.

these steps remove the above error in mine case.