Reputation: 1018
So I have this header file:
#pragma once
#include "engine.hpp"
namespace spacecubes
{
extern engine* _engine;
}
and the included engine.hpp:
#pragma once
#include <iostream>
#include "glinclude.hpp"
#include "debug.hpp"
#include "convert.hpp"
#include "renderer.hpp"
#include "global.hpp"
namespace spacecubes {
void display();
class engine {
renderer renderengine;
public:
void start(int argc, char* argv[]);
void stop(int status = 0);
void poll();
renderer getRenderEngine() {return renderengine;}
};
}
What the compiler reported later on was:
g++ -c -o bin/obj/engine.o src/engine.cpp
In file included from src/engine.hpp:9,
from src/engine.cpp:1:
src/global.hpp:7: error: expected initializer before '*' token
src/engine.cpp: In function 'void spacecubes::display()':
src/engine.cpp:5: error: '_engine' was not declared in this scope
I don't get it. What did it mean that it expected an init? Thanks in advance!
Upvotes: 0
Views: 5899
Reputation: 258568
Replace
#include "engine.hpp"
with a forward declaration:
namespace spacecubes { class engine; }
Upvotes: 1