identifier "_ZN3pov6cuoptsE" is undefined

Hi guys,

I was wondering if someone could help me out. I’m trying to get a program running with CUDA, and I’ve written a load of code and am running through the errors that are being given out by g++ and nvcc at compilation, but ran into one I can’t figure out from nvcc. It’s telling me that an identifier (in title) isn’t defined, yet from what I can see it is?

The code I have is :

#include "cuColutils.cuh"

#include "cuColour.cuh"

#include "cuPovray.cuh"

namespace pov {

    extern cuOpts *cuopts;

__device__ void cuClipColorAA(COLOUR color) {

        if (cuopts->AntialiasClipped)

            cuClip_Colour(Color, Color);



Judging by the error, it is the “cuopts” that is supposedly undefined, however it is being defined as extern right above it?

Does anyone have any ideas??


If it isn’t defined in the same translation unit as where you are compiling that code, then it is undefined as far as the device code compiler is concerned. There is no device code linker in CUDA at the moment.

Ah right. So should i just include the file that it is originally declared in? Would that solve it?

Yes it should do. Just make sure you don’t inadvertently include it twice, because that will produce a duplicate symbol error from the host linker.

These days I tend to write code a bit like I was writing a C++ template library - you define everything in headers and do the actual instantiation in only one place, so that the the equivalent of what gets loaded into a single device context will be compiled into a single object file.