Sign in to follow this  

Loopy linking

This topic is 3576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Right, I've decided I really, really, REALLY hate the C++ preprocessor, and might just go and write my next code in D, but that's not the problem. I'm using a couple of renderer classes called I_Renderer and OGLRenderer, which derives from I_Renderer. They are in the mglGraphics.h file, which is included in one slightly monolithic header, called locus_main.h (I'll show it in a minute) which each header and each source file includes, like so;
#ifndef LOCUS_MAIN_H
#define LOCUS_MAIN_H

#include <windows.h>
#include <cmath>

...

// misc
#include <error.h>
#include <mglFile.h>
#include <mglSingleton.h>
#include <mglTime.h>
#include <mglResourceManager.h>

// OS dependant
#include "mglWindow.h"
#include "mglInput.h"

// math
#include "locus_math.h"
#include "frustum.h"

// graphics
#include <gl/gl.h>
#include "texture.h"
#include "mglGraphics.h"
#include "level.h"

    // graphics constants
    /*const Engine::RGBA_COL RGB_BLACK(0.0f);
    const Engine::RGBA_COL RGB_WHITE(1.0f);*/

//physics
#include "physics.h"

// sound
#include "sound.h"

// scene
#include "scene_entity.h"
#include "scene_graph.h"
#include "scene.h"

// the application class to wrap all of the above
#include "locus_application.h"

#endif // LOCUS_MAIN_H

and the mglGraphics.h
#ifndef H_GRAPHICS
#define H_GRAPHICS

#include "locus_main.h"

#include <windows.h>
#include <gl/gl.h>
#include <cmath>


namespace Engine
{

class I_Renderer
{
...
};

class OGLRenderer:public I_Renderer
{
...
};

}

Now, when I try;
#ifndef APPLICATION_H
#define APPLICATION_H

#include "locus_main.h"

class App
{
        Engine::Window m_wnd;
        Engine::mglInput* m_input;
        Engine::mglTime m_timer;
        Engine::OGLRenderer* render;

    public:

        virtual void Init();
        virtual void Go();

        virtual ~App(){}
};

#endif // APPLICATION_H


and compile, I'm told
locus_application.h:11: error: using-declaration for non-member at class scope
locus_application.h:11: error: expected `;' before '*' token
:: === Build finished: 2 errors, 0 warnings ===
Does anyone have any ideas, as I'm completely stumped

Share this post


Link to post
Share on other sites
Best guess, you forgot to put a ; after one of your classes in one of your included files.

Share this post


Link to post
Share on other sites
Excellent, thanks. It appears rip-offs link was what I was looking for, but thank you Antheus, as well, for the prompt reply

Share this post


Link to post
Share on other sites
Sign in to follow this