Calling rtTransformNormal in header file

In implementing multiple closest_hit_radiance() programs the same thing is being done in the beginning of each one, namely the transformation of the normals returned by the intersection program from OBJECT coordinates to WORLD coordinates. I would like to refactor the calls to rtTransformNormal() to a single function in a header and then have each program include the header file and call the common code. I tried this, including <optix.h> and <optixu/optixu_math_namespace.h> in my header file (the same includes in my closest hit programs), but I get compile errors:

error C2065: ‘RT_OBJECT_TO_WORLD’ : undeclared identifier
error C3861: ‘rtTransformNormal’: identifier not found

Is there a way to do this without running into compile problems when the library changes in the future?

Thanks in advance.

Those look like Microsoft Visual Studio errors.
Did you include that header inside host code as well?

If you put your functions into headers which are only included inside OptiX CUDA program *.cu files and those are compiled by nvcc to PTX these errors shouldn’t happen.

I use many of such functions and declare them with RT_FUNCTION which I define as
#define RT_FUNCTION forceinline device
That makes it easy to distinguish them from RT_PROGRAM and RT_CALLABLE_PROGRAM.

Correct I am using Visual Studio. I ended up implementing an RT_CALLABLE_PROGRAM and that worked for rtTransformNormal.