Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9000637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:20:08+00:00 2026-06-16T00:20:08+00:00

So I have this header file: #pragma once #include engine.hpp namespace spacecubes { extern

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:20:08+00:00Added an answer on June 16, 2026 at 12:20 am

    Replace

    #include "engine.hpp"
    

    with a forward declaration:

    namespace spacecubes { class engine; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a header file like so: #pragma once #include gamestate.h #include ExitListener.h class
I have a header file that looks like this: #pragma once //C++ Output Streams
I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream>
I have a basic C++ class .The header looks like this: #pragma once class
I have the following code in a header only file. #pragma once class error_code
In the included ZenLib header file I have this define configuration //Char types #if
I have the following class: #pragma once #include <string> #include <iostream> class testclass {
I have this header file, zeeheader.h, and I wrote some classes in it, I'm
I have a header file. In this header I want to use a map
I have a macro definition in header file like this: // header.h ARRAY_SZ(a) =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.