Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: #error qmetatype.h must be included before any header file that defines Bool #57

Open
akosmaroy opened this issue Jan 5, 2015 · 9 comments

Comments

@akosmaroy
Copy link

Hi,

I'm trying to compile the code on ubuntu 14.10 with Qt 5.4 using Ninja, and I get the following:

                 from ../examples/cpp/common/qt/QtUtils.h:22,
                 from ../examples/cpp/common/Common.h:159,
                 from ../examples/cpp/common/opengl/Textures.cpp:20:
/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/qmetatype.h:53:2: error: #error qmetatype.h must be included before any header file that defines Bool
 #error qmetatype.h must be included before any header file that defines Bool

and then a bunch of similar errors. I wonder what I'm doing wrong :(

Akos

@jherico
Copy link
Member

jherico commented Jan 5, 2015

I haven't tested on anything other than windows for a while. I'll do a
pass on making sure the OSX and Linux builds are unbroken this week.

On Mon, Jan 5, 2015 at 1:01 PM, Ákos Maróy [email protected] wrote:

Hi,

I'm trying to compile the code on ubuntu 14.10 with Qt 5.4 using Ninja,
and I get the following:

             from ../examples/cpp/common/qt/QtUtils.h:22,
             from ../examples/cpp/common/Common.h:159,
             from ../examples/cpp/common/opengl/Textures.cpp:20:

/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/qmetatype.h:53:2: error: #error qmetatype.h must be included before any header file that defines Bool
#error qmetatype.h must be included before any header file that defines Bool

and then a bunch of similar errors. I wonder what I'm doing wrong :(

Akos


Reply to this email directly or view it on GitHub
#57.

@akosmaroy
Copy link
Author

thanks for looking. I had to make additional changes to make it compile on Linux (Ubuntu 14.10), please see my git diff pasted here (let me know if you need it in another form):

diff --git a/CMakeLists.txt b/CMakeLists.txt
index da10c0f..534629d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -177,7 +177,7 @@ if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
 endif()


-find_package(Qt5 ${QT_COMPONENTS})
+find_package(Qt5 QUIET)

 if (Qt5Core_FOUND)
     message(STATUS "Qt Found")
diff --git a/examples/cpp/Example_4_3_1_Distorted.cpp b/examples/cpp/Example_4_3_1_Distorted.cpp
index 7257324..117af4a 100644
--- a/examples/cpp/Example_4_3_1_Distorted.cpp
+++ b/examples/cpp/Example_4_3_1_Distorted.cpp
@@ -53,7 +53,7 @@ public:
 #if defined(OVR_OS_WIN32)
     ((ovrGLConfigData&)config).Window = 0;
 #elif defined(OVR_OS_LINUX)
-    ((ovrGLConfigData&)config).Win = 0;
+    //((ovrGLConfigData&)config).Win = 0;
     ((ovrGLConfigData&)config).Disp = 0;
 #endif

diff --git a/examples/cpp/Example_SelfContained.cpp b/examples/cpp/Example_SelfContained.cpp
index 6eb74d6..62d743d 100644
--- a/examples/cpp/Example_SelfContained.cpp
+++ b/examples/cpp/Example_SelfContained.cpp
@@ -513,7 +513,7 @@ private:
 #elif defined(OS_OSX)
 #define OVR_OS_MAC
 #elif defined(OS_LINUX)
-#define OVR_OS_LIUNX
+#define OVR_OS_LINUX
 #endif

 #include <OVR_CAPI_GL.h>
@@ -772,7 +772,7 @@ protected:
       // On windows, the SDK does a good job of automatically
       // finding the correct window.  On Linux, not so much.
       cfg.OGL.Disp = glfwGetX11Display();
-      cfg.OGL.Win = glfwGetX11Window(window);
+      //cfg.OGL.Win = glfwGetX11Window(window);
     });

     int configResult = ovrHmd_ConfigureRendering(hmd, &cfg.Config,
diff --git a/examples/cpp/common/Platform.cpp b/examples/cpp/common/Platform.cpp
index 44a06ee..5b6e6ae 100644
--- a/examples/cpp/common/Platform.cpp
+++ b/examples/cpp/common/Platform.cpp
@@ -27,6 +27,7 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <cstdarg>
 #endif

 void Platform::sleepMillis(int millis) {
@@ -108,10 +109,6 @@ std::vector<uint8_t> Platform::getResourceByteVector(Resource resource) {
   return data;
 }

-std::stringstream Platform::getResourceStream(Resource resource) {
-  return std::stringstream(Platform::getResourceString(resource));
-}
-

 std::string Platform::format(const char * fmt_str, ...) {
     int final_n, n = (int)strlen(fmt_str) * 2; /* reserve 2 times as much as the length of the fmt_str */
diff --git a/examples/cpp/common/opengl/GlUtils.cpp b/examples/cpp/common/opengl/GlUtils.cpp
index 5e69918..4da3d89 100644
--- a/examples/cpp/common/opengl/GlUtils.cpp
+++ b/examples/cpp/common/opengl/GlUtils.cpp
@@ -598,7 +598,8 @@ namespace oria {
       });

       program = loadProgram(Resource::SHADERS_LITMATERIALS_VS, Resource::SHADERS_LITCOLORED_FS);
-      std::stringstream stream = Platform::getResourceStream(Resource::MESHES_ARTIFICIAL_HORIZON_OBJ);
+      std::stringstream stream;
+      stream.str(Platform::getResourceString(Resource::MESHES_ARTIFICIAL_HORIZON_OBJ));
       shapes::ObjMesh mesh(stream);
       shape = ShapeWrapperPtr(new shapes::ShapeWrapper({ "Position", "Normal", "Material" }, mesh, *program));
       Uniform<Vec4f>(*program, "Materials[0]").Set(materials);

@akosmaroy
Copy link
Author

after compiling with the above differences, I can run examples 2.1 and 2.2 fine (the tracker is found), but none of the examples that would want to display something work :( I wonder how one should debug this.

the 'official' oculus config app & the sample inside the config app work fine.

@akosmaroy
Copy link
Author

an additional thing that is needed for compilation on Linux is to:

#define __stdcall

I'm not sure where to put this. I've put this into Config.h, but that seems to get re-generated

@jherico
Copy link
Member

jherico commented Jan 6, 2015

You can put it into Common.h or Platform.h. Common.h actually has most of
the platform specific defines. Platform.h is really just a header of
utility functions that mask a bunch of platform specific functionality.

On Mon, Jan 5, 2015 at 3:58 PM, Ákos Maróy [email protected] wrote:

an additional thing that is needed for compilation on Linux is to:

#defined __stdcall

I'm not sure where to put this. I've put this into Config.h, but that
seems to get re-generated


Reply to this email directly or view it on GitHub
#57 (comment)
.

@jherico
Copy link
Member

jherico commented Jan 6, 2015

I've applied most of the changes, or at least variations on them to get the build compiling on my Linux system. See the other issue you opened for status. Please re-open if this doesn't resolve the issues for you.

@jherico jherico closed this as completed Jan 6, 2015
@akosmaroy
Copy link
Author

I'd like to re-open this one (I'm not finding a way on how). after #58 is solved, I'm testing this on the jherico fork. I'm getting the same error as before, using Qt 5.4:

$ qmake --version
QMake version 3.0
Using Qt version 5.4.0 in /home/akos/src/oculus/usr/Qt/5.4/gcc_64/lib
$ cmake .. -G Ninja
-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Ninja
-- Check for working CXX compiler using: Ninja -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
Release build, resources will be loaded from executable/bundle
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libGL.so  
-- Using X11 for window creation
-- Using GLX for context creation
-- Looking for glXGetProcAddress
-- Looking for glXGetProcAddress - found
-- Looking for glXGetProcAddressARB
-- Looking for glXGetProcAddressARB - found
-- Looking for glXGetProcAddressEXT
-- Looking for glXGetProcAddressEXT - not found
-- OpenCV Found
-- Qt Found
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Creating OpenCV examples
-- Creating Qt examples
-- Configuring done
-- Generating done
-- Build files have been written to: /home/akos/src/oculus/src/OculusRiftInAction-jherico/build
$ ninja
[122/236] Automoc for target Example_10_Shaderfun
Generating Example_10_Shaderfun.moc
[122/236] Automoc for target ExampleCommon
Generating moc_GlslEditor.cpp
Generating RiftQtApp.moc
/home/akos/src/oculus/src/OculusRiftInAction-jherico/examples/cpp/common/qt/RiftQtApp.cpp:134: Note: No relevant classes found. No output generated.
Generating moc_QtUtils.cpp
Generating moc_RiftQtApp.cpp
[133/236] Building CXX object examples...s/ExampleCommon.dir/glfw/GlfwApp.cpp.o
FAILED: /usr/bin/c++   -DGLEW_STATIC -DOGLPLUS_LOW_PROFILE=1 -DOGLPLUS_NO_SITE_CONFIG=1 -DOGLPLUS_USE_BOOST_CONFIG=1 -DOGLPLUS_USE_GLEW=1 -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_QML_LIB -DQT_QUICKWIDGETS_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -std=c++11 -fPIC -fPIC -Iexamples/cpp/common -I../examples/cpp/common -I/usr/include/opencv -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/mkspecs/linux-g++ -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtWidgets -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtGui -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtQuickWidgets -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtQuick -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtQml -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtNetwork -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtOpenGL -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtXml -I/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtXmlPatterns -I../resources/cpp -Iresources -I../libraries/boostconfig/include -I../libraries/glm -I../libraries/glew/include -I../libraries/glfw/include -I../libraries/oglplus/include -I../libraries/oglplus/implement -Ilibraries/oglplus/include -I../libraries/OpenCTM -I../libraries/OculusSDK/LibOVR/Src -MMD -MT examples/cpp/common/CMakeFiles/ExampleCommon.dir/glfw/GlfwApp.cpp.o -MF "examples/cpp/common/CMakeFiles/ExampleCommon.dir/glfw/GlfwApp.cpp.o.d" -o examples/cpp/common/CMakeFiles/ExampleCommon.dir/glfw/GlfwApp.cpp.o -c ../examples/cpp/common/glfw/GlfwApp.cpp
In file included from /home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/qobject.h:48:0,
                 from /home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/qabstractanimation.h:37,
                 from /home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/QtCore:4,
                 from /home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtWidgets/QtWidgetsDepends:3,
                 from /home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtWidgets/QtWidgets:3,
                 from ../examples/cpp/common/qt/QtUtils.h:21,
                 from ../examples/cpp/common/Common.h:159,
                 from ../examples/cpp/common/glfw/GlfwApp.cpp:20:
/home/akos/src/oculus/usr/Qt/5.4/gcc_64/include/QtCore/qmetatype.h:53:2: error: #error qmetatype.h must be included before any header file that defines Bool
 #error qmetatype.h must be included before any header file that defines Bool
  ^

and then a zillion more errors

@jherico jherico reopened this Jan 7, 2015
@jherico
Copy link
Member

jherico commented Jan 8, 2015

I've reproduced this on 12.04. It seems Qt is pretty finicky about other library headers. Initial attempts at reordering the headers hasn't produced great results yet, but I'm still investigating.

@jherico
Copy link
Member

jherico commented Jan 10, 2015

I've made some changes (in my fork) to get the compilation working on Linux. The library seems to compile fine now, although the shadertoy example (the only thing actually using Qt at the moment) is still failing to compile. I'll keep working on it to try to determine the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants