I want to use both OptiX and Thrust in my application.
But I get a lot of compiler errors (“‘cudaError_t’” does not name a type" etc.) having the following order of includes:
#include <optix_world.h>
#include <thrust/device_ptr.h>
If I swap those two lines everything compiles successfully:
#include <thrust/device_ptr.h>
#include <optix_world.h>
When I investigated that issue I found out that in optixu/optixu_vector_types.h the following lines cause the problem:
namespace optix {
#include <vector_types.h>
}
All CUDA types now reside in the optix:: namespace, which makes it impossible for Thrust to correctly reference these types. This does not get executed if <vector_types.h> is included somewhere before the OptiX header.
A similar issue occurs within optixu/optixu_vector_functions.h.
For now, I could either
- add "using namespace optix;" whenever I include the OptiX header or
- always make sure the correct order of includes.
I don’t really like both “solutions”, but would rather ask the OptiX developers not to change the CUDA types and functions.
Is this possible in the next release?