Page 1 of 1

Attempting to build

Posted: Wed Jan 17, 2018 03:02
by jay74
Hello,

I'm attempting to use the Old desktop OpenGL 1.2 (Fixed Function) version of CEGUI. I'm building with plain old

Code: Select all

cmake ..
make
make install

Does building for OpenGL 1.2 require any special options?

The Desktop OpenGL 3.2 or OpenGL ES 2.0 version required some additional options during the build

Code: Select all

cmake .. -DCEGUI_BUILD_RENDERER_OPENGL=OFF -DCEGUI_BUILD_RENDERER_OPENGL3=ON -DCEGUI_USE_EPOXY=ON -DCEGUI_USE_GLEW=OFF
make
make install


The reason why I ask is that when I attempt to compile code using it I get the following

Code: Select all

In file included from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/GL.h:38:0,
                 from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/RendererBase.h:37,
                 from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/GL3Renderer.h:30,
                 from /home/jay/projects/game3d/src/../headers/main.hpp:6,
                 from /home/jay/projects/game3d/src/main.cpp:1:
/usr/include/GL/glew.h:85:2: error: #error gl.h included before glew.h


I figure I must be missing some step in my build. To trouble shoot, I went around including glew.h manually, but i could tell that was going to be disastrous. So, my assumption is that I did something wrong and the first suspect is my build.

Thank you,
Jay

Re: Attempting to build

Posted: Wed Jan 17, 2018 03:51
by jay74
I tried it with these options but I got the same results.

Code: Select all

# cmake .. -DCEGUI_BUILD_RENDERER_OPENGL=ON -DCEGUI_BUILD_RENDERER_OPENGL3=OFF -DCEGUI_USE_EPOXY=OFF -DCEGUI_USE_GLEW=ON
# make
# make install

Re: Attempting to build

Posted: Wed Jan 17, 2018 04:11
by Ident
Version?

Re: Attempting to build

Posted: Wed Jan 17, 2018 04:14
by Ident
You might have included a CEGUI header AFTER you included gl.h.

Suggested order for including headers of dependencies, internal project files, and std files is:

First the header matching the cpp
Then the local project files
Then the dependencies (first the higher level ones like CEGUI, then the specific ones that are more atomic like glm, glew, etc)
Then the std files

Re: Attempting to build

Posted: Wed Jan 17, 2018 04:53
by jay74
Thank you for you assistance. I really appreciate it.

I made a few changes. I think that I'm doing what you are directing, but I am probably not.

Error:

Code: Select all

In file included from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/GL.h:38:0,
                 from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/RendererBase.h:37,
                 from /usr/local/include/cegui-0/CEGUI/RendererModules/OpenGL/GLRenderer.h:31,
                 from /home/jay/projects/game3d/src/../headers/../headers/../headers/../headers/client_cegui_drawable.hpp:7,
                 from /home/jay/projects/game3d/src/../headers/../headers/../headers/event_handler_cegui.hpp:4,
                 from /home/jay/projects/game3d/src/../headers/../headers/client_master.hpp:4,
                 from /home/jay/projects/game3d/src/../headers/main.hpp:4,
                 from /home/jay/projects/game3d/src/main.cpp:1:
/usr/include/GL/glew.h:85:2: error: #error gl.h included before glew.h
 #error gl.h included before glew.h


main.cpp

Code: Select all

#include "../headers/main.hpp"


int main() {
    ServerMaster sm;
    ClientMaster cm;

    sm.start();
    cm.start( &sm );

    while( sm.get_playing() ) {
        sm.update();
        cm.input();
        cm.render();
        cm.update_terrain();
    }

    sm.stop();

    return 0;
}


main.hpp

Code: Select all

#ifndef MAIN_H
#define MAIN_H

#include "../headers/client_master.hpp"
#include "../headers/server_master.hpp"


#endif


client_master.hpp

Code: Select all

#ifndef CLIENT_MASTER_H
#define CLIENT_MASTER_H

#include "../headers/event_handler_cegui.hpp"
...
#include <stuff>
#include <more stuff>
...
#include <iostream>
#include <string>
#include <sstream>
#include <map>
#include <tuple>

class ClientMaster{ ... };

#endif


event_handler_cegui.hpp

Code: Select all

#ifndef EVENT_HANDLER_CEGUI_H
#define EVENT_HANDLER_CEGUI_H

#include "../headers/client_cegui_drawable.hpp"

#include <stuff>

class EventHandlerCEGUI : public osgGA::GUIEventHandler { ... };

#endif


client_cegui_drawable.hpp

Code: Select all

#ifndef CLIENT_CEGUI_DRAWABLE_H
#define CLIENT_CEGUI_DRAWABLE_H

#include <epoxy/gl.h>
#include <CEGUI.h>
#include <RendererModules/OpenGL/GLRenderer.h>
#include <osg/Drawable>
#include <iostream>
#include <string>

class ClientCEGUIDrawable : public osg::Drawable { ... };

#endif

Re: Attempting to build

Posted: Wed Jan 17, 2018 04:57
by jay74
Version info:
OS: Fedora Release 26
Compiler: g++ (GCC) 7.2.1
CEGUI: 0.8.7
OpenGL: 3.0 Mesa 17.2.4

Re: Attempting to build

Posted: Thu Jan 18, 2018 02:55
by jay74
Thank you. A good night's rest and fresh eyes were what I needed to find the problem. You were correct and the issue error is resolved. Thank you again.