Compile error in threadPosixImpl.h

I am trying to compile panda on a Red Hat Enterprise Linux 5 system with threading enabled and I get the following error:

make[1]: Entering directory `/disk1/scratch/panda3d-2/panda/src/display’
g++ -ftemplate-depth-30 -c -o Opt3-Linux/libdisplay_igate.o … Opt3-Linux/libdisplay_igate.cxx
…/pipeline/threadPosixImpl.h:61: error: expected identifier before ‘int’
…/pipeline/threadPosixImpl.h:61: error: expected unqualified-id before ‘{’ token
…/pipeline/threadPosixImpl.I: In constructor ‘ThreadPosixImpl::ThreadPosixImpl(Thread*)’:
…/pipeline/threadPosixImpl.I:27: error: ‘S_new’ was not declared in this scope

I am using gcc 4.1.2. I did a grep of all of the Panda source code and the system header files and I cannot find this defined anywhere. Where is this suppose to be defined? If I disable threading then I can’t compile the Cg module because Nvidia’s Cg toolkit is compiled with threading enabled.

S_new is defined in threadPosixImpl.h, just a few lines past line 61, which is where the first error message appears. So it must be the first error that’s causing the real problem. In my version of the code, there’s a blank line at line 61, so you must have a different version–which version of the code are you compiling?

Incidentally, just because the Cg toolkit uses threading, does not mean that you also need to compile Panda with threading enabled.


I’m compiling with the source archive for 1.7.0. I didn’t notice that the ‘S_new’ error was at a different line than the other errors.

Here is the code immediately surrounding line 61:

59: static void init_pt_ptr_index();
61: enum Status {
62: S_new,
63: S_start_called,
64: S_running,
65: S_finished,
66: };

I realize that I don’t need to enable threading to get it to compile with Cg, but I preferred having threading enabled and it was the easiest way to get the -lpthread flags in the necessary Makefiles.

Perhaps one of the system header files on your machine has a “#define Status …something unhelpful…”, or something like this. What happens if you change the two appearances of Status in this file to something else, like TStatus?


I tried that and was waiting for the compile to finish. I changed it to pStatus and it seems to have worked.

OK, thanks! That makes it just one more in a long series of name collisions we’ve had to deal with over the years. Silly legacy C global name scoping. I’ll make a similar change to the source repository.