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 825341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:14:21+00:00 2026-05-15T03:14:21+00:00

The code of Game.h : #ifndef GAME_H #define GAME_H class Game { public: const

  • 0

The code of Game.h:

#ifndef GAME_H
#define GAME_H

class Game
{
    public:
        const static string QUIT_GAME; // line 8
        virtual void playGame() = 0;
};

#endif

The error:

game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
game.h(8): error C2146: syntax error : missing ';' before identifier 'QUIT_GAME'
game.h(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

What am I doing wrong?

  • 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-05-15T03:14:21+00:00Added an answer on May 15, 2026 at 3:14 am

    Here is what you need to fix your issues:

    1. Include the string header file:
    #include <string>

    2. Prefix string with its namespace:
    const static std::string QUIT_GAME;

    or insert a using statement:

    #include <string>
    using std::string;
    

    3. Allocate space for the variable
    Since you declared it as static within the class, it must be defined somewhere in the code:
    const std::string Game::QUIT_GAME;

    4. Initialize the variable with a value
    Since you declared the string with const, you will need to initialize it to a value (or it will remain a constant empty string).:
    const std::string Game::QUIT_GAME = "Do you want to quit?\n";

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

Sidebar

Related Questions

I have a game code (from ioquake3 project) that compiles part of gameplay binaries
I am currently in the process of porting game code from PC to flash,
How do I utilize fibers best in my game code? Should it only be
I have an underlying ruby game-engine code and I want to use the web
All, I am trying to code a Connect4 game. For this, I have created
The following code is a simple thread game, that switches between threads causing the
I have code like this to move the player in my game left, right,
I've worked out most of the code and have several game classes. The one
I'm making a multiplayer flash game that has a lot of graphics/code. I'm having
I'm porting a UT3 game to UDK . It uses a large code library

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.