Problem with OpenGl_GlFunctions.hxx (occ version 6.8.1)

I have downloaded the official occ 6.8.0 zip file and built it in my OpenSuSE 13.1 box using cmake. The build seemed to be successful.

I now want to build a small example project written by some one else which I have downloaded from his github site. When trying to build this code I get a number of "does not name a type" errors all coming from the OpenGl_GlFunctions.hxx file. Does anyone know why this error occurs and what to do about it?

The project uses qmake.

/M

Michael T's picture

I think that the problem is related to the glext.h file. The errors I get should all be solved if the local (provided bu occ) glet.h file is loaded by the OpenGl_GlFunctions.hxx header. Somehow I doubt that it does since I get the following error message:

/usr/include/occ-6.8.0/OpenGl_GlFunctions.hxx:714:3: error: ‘PFNGLCLIENTACTIVETEXTUREPROC’ does not name a type
PFNGLCLIENTACTIVETEXTUREPROC glClientActiveTexture;
^
c++: internal compiler error: Aborted (program cc1plus)

I have now switched to cmake.

Anyone?

/M

qingchao li's picture

I've had the same problem.
My "include" order in occView.h:

#include
#include

#include
#include

Good luck!

Solomin Sergey's picture

Hello, Michael.

I've had a similar problem. The main problem is occ and qt have build-in glext.h files. And Linux has system glext.h file. So every file check __glext_h_ macro and try include code. But glext.h has different behaviour dependent of external macros, so you should include some occ files including glext.h before including qt or system headers which can also include glext.h.
For example you should include OpenGl_GraphicDriver.hxx or Xw_Window.hxx before some QtGui or QtQuick files (e.g. QQuickWindow).
You can also get more information about compile (pre)processing using "-E -dD -dI" flags with g++.

Michael T's picture

Thank you Sergey for answering!
I have tried to change the order in which I include header files (Qt and OCC). So far it does not help me in removing the error. Probably I am not seeing the include order correctly.

I have tried the -H option for g++ and this produces an enormous list of all include files and their hierarchical order. I will have to study this more closely.

Your suggestion of using the "-E -dD -dI" flags with g++ is not clear to me. It only produces the following which I cannot iterpret in any helpful way for my problem:

scanning dependencies of target tags
[ 0%] Built target tags
[ 14%] Generating moc_occView.cxx
[ 28%] Generating moc_occQt.cxx
Scanning dependencies of target occQt
[ 42%] Building CXX object CMakeFiles/occQt.dir/main.cpp.o
[ 57%] Building CXX object CMakeFiles/occQt.dir/occQt.cpp.o
[ 71%] Building CXX object CMakeFiles/occQt.dir/occView.cpp.o
[ 85%] Building CXX object CMakeFiles/occQt.dir/moc_occQt.cxx.o
[100%] Building CXX object CMakeFiles/occQt.dir/moc_occView.cxx.o
Linking CXX executable occQt
c++: warning: CMakeFiles/occQt.dir/main.cpp.o: linker input file unused because linking not done
c++: warning: CMakeFiles/occQt.dir/occQt.cpp.o: linker input file unused because linking not done
c++: warning: CMakeFiles/occQt.dir/occView.cpp.o: linker input file unused because linking not done
c++: warning: CMakeFiles/occQt.dir/moc_occQt.cxx.o: linker input file unused because linking not done
c++: warning: CMakeFiles/occQt.dir/moc_occView.cxx.o: linker input file unused because linking not done
[100%] Built target occQt

I am currently looking into the installation of the occ 6.8.1 library. On OpenSuse there is only an older version available (version 6.5.0) so I have tried to compile a new version from source. My problem here is that the instructions given are not complete for Linux. I have posted a question under the Installation and Building category of the forum.

Solomin Sergey's picture

Hello, Michael.

I meant that you should build manually your files (which have compile error), using my additional flags :-)
-E Preprocess only; do not compile, assemble or link
-dD Show #define directives and result of preprocessing.
-dI Output `#include' directives in addition to the result of preprocessing.

So, you should see a lot of code with all include files in output, no binary file. But it helps you find place where needed header was included, and choose correct way for including.
My "include" order:
// local project includes
// occ includes (e.g. GC_MakeArcOfCircle.hxx, which will be has conflicts)
#include
#include
#ifdef CursorShape
#undef CursorShape
#endif
// Qt includes.
// another includes

Good luck!

p.s. For getting compile line with cmake call "make VERBOSE=1". Don't forget about -o <...> g++'s flag which redirect output.