所以我有这个头文件:
#pragma once
#include "engine.hpp"
namespace spacecubes
{
extern engine* _engine;
}
和包含的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;}
};
}
编译器后来报告的是:
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
我不明白。它期望一个init是什么意思?提前致谢!