I get the same issue with gcc 4.8.1.
Fix seems OK.
However - it seems from the comment in the source that this include statement was left out on purpose.
include/Inventor/SbBasic.h, line 100:
// cc_debugerror_post() is not attempted resolved before the template is
// used, hence the missing Inventor/errors/SoDebugError.h #include. This
// "trick" does only work portably for functions in the global namespace.
I do hope the project owners get responsive again, but since there seem to be no activity in the last year, I suggest we try helping each other and get a single working branch integrating the 3 existing pull requests.
Can you help dig up further to see what they were trying to do, and why it stopped working now?
Perhaps we can fix that in a way that would preserve the original intention?
(Maybe recent versions of gcc do try to instatiate that template in cases where they did not before?
Or maybe the NDEBUG macro should get defined somehow, etc.)
I stumbled upon the problem only when I tried to build a package for Arch Linux. I do not know much about the internals of Coin. When doing research about the problem, I found out that Debian has a fix for this since a long time (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=667375), and as I did not see any upstream report of this, I simply created this pull request.
So I guess I am not of much help to find out the original intention.
I can see where you are coming from, even though I am not yet (I am trying Kubuntu) a Linux user. However, what worries me somewhat is that the SbBasic.h include file is a low level file. SoDebugError.h, and debugerror.h (where the function is actually defined) are the higher level files that include SbBasic.h.
So are you guys sure that this is the change you want? I can check it out in Windows / Visual Studio, but Is it going to be OK on a Mac?
I don't think the original 'trick' described in the comment will work on modern C++ compilers anymore. The C++ standard requires compilers to resolve all names in templates that do not depend on template parameters, even if the template is not instantiated. Therefore, new compilers will complain about the code.
The same error comes up on latest clang (LLVM) compiler on Mac OSX.
An alternative to the header file inclusion could be a forward declaration. This would not add additional headers to parse.
I accidentally updated this pull request to include the changes for CMake and cannot find a way to undo it. It originally only included the fix for missing include file on current GCC.
Please let me know if i should create seperate pull requests, or of this is fine.
I've tried to build with CMake on OSX from the version available on https://bitbucket.org/cbuehler/coin and I come to some errors related to :
- COIN_DEBUG wich is not set properly to 0 or 1 as it should be
- OpenGL headers need to be set specifically for OSX. They are in OpenGL/gl.h rather then GL/gl.h
- GL/glx.h comes only with X11 nor with OpenGL framework. Disabled on OSX
I haven't tested but I suspect that the FindCoin3D.cmake file provided with CMake is no more able to find coin. Having a look inside it searches in /Library/Frameworks/Inventor.framework... I don't know if it works on other plaforms then OSX
Here the errors I encounter before the changes:
$ cmake -DCMAKE_VERBOSE_MAKEFILE=ON ..
[ 0%] Building CXX object src/CMakeFiles/Coin.dir/xml/document.cpp.o
cd /Users/fspindle/poub/coin-cmake/coin/build-cmake/src && /usr/bin/c++ -DCoin_EXPORTS -DYY_NO_UNISTD_H -DCOIN_DEBUG="\$<CONFIG:Debug>" -DCOIN_INTERNAL -DGLX_GLXEXT_PROTOTYPES -DHAVE_CONFIG_H -fPIC -I/Users/fspindle/poub/coin-cmake/coin/src -I/Users/fspindle/poub/coin-cmake/coin/include -I/Users/fspindle/poub/coin-cmake/coin/include/Inventor/annex -I/Users/fspindle/poub/coin-cmake/coin/build-cmake -o CMakeFiles/Coin.dir/xml/document.cpp.o -c /Users/fspindle/poub/coin-cmake/coin/src/xml/document.cpp
In file included from /Users/fspindle/poub/coin-cmake/coin/src/xml/document.cpp:47:
/Users/fspindle/poub/coin-cmake/coin/src/coindefs.h:93:5: error: ':' without preceding '?'
After modifying the CMakeLists.txt I come to the next error indicating that OpenGL headers are not found. They are in OpenGL/gl.h...
[ 1%] Building CXX object src/CMakeFiles/Coin.dir/actions/SoAction.cpp.o
cd /Users/fspindle/poub/coin-cmake/coin/build-cmake/src && /usr/bin/c++ -DCoin_EXPORTS -DYY_NO_UNISTD_H -DCOIN_DEBUG=0 -DCOIN_INTERNAL -DGLX_GLXEXT_PROTOTYPES -DHAVE_CONFIG_H -fPIC -I/Users/fspindle/poub/coin-cmake/coin/src -I/Users/fspindle/poub/coin-cmake/coin/include -I/Users/fspindle/poub/coin-cmake/coin/include/Inventor/annex -I/Users/fspindle/poub/coin-cmake/coin/build-cmake -o CMakeFiles/Coin.dir/actions/SoAction.cpp.o -c /Users/fspindle/poub/coin-cmake/coin/src/actions/SoAction.cpp
In file included from /Users/fspindle/poub/coin-cmake/coin/include/Inventor/system/gl.h:47,
/Users/fspindle/poub/coin-cmake/coin/build-cmake/Inventor/system/gl-headers.h:47:19: error: GL/gl.h: No such file or directory
/Users/fspindle/poub/coin-cmake/coin/build-cmake/Inventor/system/gl-headers.h:48:20: error: GL/glu.h: No such file or directory
/Users/fspindle/poub/coin-cmake/coin/build-cmake/Inventor/system/gl-headers.h:49:22: error: GL/glext.h: No such file or directory
In file included from /Users/fspindle/poub/coin-cmake/coin/src/actions/SoAction.cpp:233:
/Users/fspindle/poub/coin-cmake/coin/src/profiler/SoNodeProfiling.h: In member function ‘void SoNodeProfiling::postTraversal(SoAction*)’:
/Users/fspindle/poub/coin-cmake/coin/src/profiler/SoNodeProfiling.h:95: error: ‘glFinish’ was not declared in this scope
Here the next error related to glx that doesn't exist in the OpenGL framework
[ 46%] Building CXX object src/CMakeFiles/Coin.dir/glue/gl.cpp.o
cd /Users/fspindle/soft/third-party/Coin3D/coin-build/src && /usr/bin/c++ -DCoin_EXPORTS -DYY_NO_UNISTD_H -DCOIN_DEBUG=0 -DCOIN_INTERNAL -DGLX_GLXEXT_PROTOTYPES -DHAVE_CONFIG_H -fPIC -I/Users/fspindle/soft/third-party/Coin3D/coin/src -I/Users/fspindle/soft/third-party/Coin3D/coin/include -I/Users/fspindle/soft/third-party/Coin3D/coin/include/Inventor/annex -I/Users/fspindle/soft/third-party/Coin3D/coin-build -o CMakeFiles/Coin.dir/glue/gl.cpp.o -c /Users/fspindle/soft/third-party/Coin3D/coin/src/glue/gl.cpp
/Users/fspindle/soft/third-party/Coin3D/coin/src/glue/gl.cpp:232:20: error: GL/glx.h: No such file or directory
/Users/fspindle/soft/third-party/Coin3D/coin/src/glue/gl.cpp: In function ‘void* coin_gl_current_context()’:
/Users/fspindle/soft/third-party/Coin3D/coin/src/glue/gl.cpp:5188: error: ‘glXGetCurrentContext’ was not declared in this scope