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

  • SEARCH
  • Home
  • 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 8978223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:33:31+00:00 2026-06-15T19:33:31+00:00

I have declared a class in a header file (.h), and I defined its

  • 0

I have declared a class in a header file (.h), and I defined its constructor and functions (including default constructor) in a .cpp

Now I want to declare an object in another header file, and initialize it in another .cpp file. I need to do it like this because the initialization of the object depends on some variables in the cpp.
The declaration in the .h file is made like this:

Saboteur *activeFault; /*Saboteur is the class, activeFault the object*/

When I try to compile my program I get the following error:

error C2143: syntax error : missing ‘;’ before ‘*’.

Any clue why this happens??

Hint: #includes are all ok, and the most strange thing is that I get the error when the compiler tries to compile the .cpp file where the functions of the class Saboteur are defined, but it says that the error is in the line written above (which is the other cpp file).

  • 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-15T19:33:32+00:00Added an answer on June 15, 2026 at 7:33 pm

    Prototype the Saboteur class. Declare:

    class Saboteur;
    

    before that declaration of activeFault.

    Then, in other place, you provide the full definition of class Saboteur.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test class declared in a header file and defined in a
I have a class declared like this in a header file : class COMPLEX{
(In C++) I have a class whose structure is declared in a header file.
I have a C++ class that is declared and implemented in a header file.
I have a template defined in my header file as follows: template<typename T> class
I have enum declared in a header file called sm.h enum GameStates { STATE_NULL
I have a class in header file: class Employee { //Private data members private:
I have one header file which uses a virtual function. This is declared and
I have a class which defines the following members in a header file (.hpp):
I have a header file which declares the prototype for the constructor. In 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.