Cannot compile x64 samples


I cannot seem to get the OptiX samples compiled. I’m using OptiX SDK 3.6.3 (64 bit), CMake (32 bit), CUDA 5.5 (64 bit) and finally Visual Studio 2012 (32 bit, I can’t get access to a 64 bit install).

Eveything in CMake seems to work, I configure for Visual Studio 11, 2012 x64.
But once I open the .sln and try to build I get a bunch of weird erros:

When I look at the output I find this problem:

He says this for every .cu file in the solution.

The only equivalent thread I could find was this one: CUDA can't find crtdefs.h - CUDA Programming and Performance - NVIDIA Developer Forums

I tried the solution provided by griddlebone, but this didn’t help.

Any ideas?

Just to clarify, you’re creating a project for Visual Studio 2012 x64 but opening it with Visual Studio 2012 x86? It seems like this could lead to some issues, but let’s give it the benefit of the doubt for now.

Have you checked to make sure that you have the crtdefs.h file in the path pointed to by griddlebone’s solution? Since his solution was for Visual Studio 9.0 and you have Visual Studio 11.0, you would at the very least need to change the path. Presumably, your path is something like “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”.

Thanks for the quick reply, nljones!

I’d love to work in Visual Studio x64, but can’t. I’d also love to install OptiX and CUDA as 32bit, but the CUDA installation wont let me because I run a x64 windows.

Yes, I checked and “crtdefs.h” is found in my path: “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”

I added this to my nvcc.profile:

INCLUDES += “-I$(TOP)/include” “-I$(TOP)/include/cudart” “-IC:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include” $(SPACE)

I still get the following error:
1> c:\program files\nvidia gpu computing
1>toolkit\cuda\v5.5\include\host_config.h(149): fatal error C1083: Cannot
1> open include file: ‘crtdefs.h’: No such file or directory

I feel really stupid… the solution I posted earlier DOES work, I just edited the wrong nvcc.profile from another CUDA install… Thanks for your time anyway nljones! This took me a day to figure out, bah!

Although I still can’t get it to compile:

What can cause this???

The files that are shown missing, stdio.h and excpt.h, should also be in “C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include”. First check that they are there.

I still suspect that this might be caused by some other issue with the 32-bit vs 64-bit compiler. Even though you have installed CUDA x64, you can still build a 32-bit version of the .sln file with CMake and run this with the 32-bit binaries provided with the OptiX SDK. Does the error still persist if you do this?

Both stdio.h and excpt.h are in the folder. I made a 32-bit project with CMake after installing OptiX 32-bit. I still have the same problem, only even more files are missing now:

For some reason, your Visual Studio project is not finding files in the Visual Studio include directory. Have you been able to compile other projects with your Visual Studio installation? Have you compiled other OptiX projects?

I would check the documentation for an Error C1083. In particular, make sure your include directory value is correct (it’s probably set up using a macro).

If none of this helps, you might also try installing Visual Studio 2010, which is what I and I think most of the people posting on this board are using. OptiX has supported VS2012 for more than a year now, but there might still be some bugs.

Strange, I can’t seem the compile any project (I usually work in 2013) I’ve installed 2012 on my D: drive, and my VCdirectories point to that installation, but it indeed does not contain those headers. For some reason they are on my C: drive… Should I re install and just put everything on my C: drive?

I have installed Visual Studio 2012 32-bit and it works now! Thank you very much! :)