Persistent buffer error on basic program

Hi

For a couple of weeks and through several different project setups, I have constantly run into the same bug over and over when running this basic program:

#include <optix_world.h>
#include <optixu/optixu_math_namespace.h>

using namespace optix;

rtBuffer<float4, 2> output_buffer;
rtDeclareVariable(uint2, launch_index, rtLaunchIndex, );
rtDeclareVariable(float4, bg_colour, , );

RT_PROGRAM void pinhole_camera()
{
output_buffer[launch_index] = bg_colour;
}

According to the compiler everything compiles fine, however at runtime it spits out this error:

OptiX Error: Parse error (Details: Function “_rtProgramCreateFromPTXFile” caught exception: Can’t find definition of buffer for instruction: call (%rd20), _rt_buffer_get_64, (%rd21, %r7, %r8, %rd22, %rd23, %rd24, %rd25);, [5571728])

I have tried using different many different compiler setting, changing the host program to C++, copying properties directly from the samples, and copying files directly from the wizard example, but this error will not go away. Any help in either pointing me in the right direction or explaining what I may be doing wrong is greatly appreciated.

Did you setup your output buffer variable at context scope?

What’s your exact system configuration?
OS version and bitness, installed GPU(s), display driver version, OptiX version, CUDA toolkit version to compile to PTX.

Note that the newest working configurations for OptiX 3.9.0 are CUDA Toolkit 7.5 with MSVS 2013 Professional or Community edition (not MSVS 2015 or Express editions).

Do you use any debug flags on the nvcc command line? Remove -g and -G flags if present. (See OptiX Programming Guide chapter 5.3 “PTX Generation”.)
Is this a 32-bit application? Please use 64-bit then, 32-bit is not supported anymore.