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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:35:41+00:00 2026-06-17T06:35:41+00:00

I was compiling a C++ program that makes use of the C++ keyword override.

  • 0

I was compiling a C++ program that makes use of the C++ keyword “override”.

I compiled it successfully in Visual Studio 2010, but now I need to compile it on g++. Only g++ 4.6 is available (and you need g++ 4.7 to support “override”).

The real solution is to install g++ 4.7 (which is happening now), but it got me thinking. Is there a compile-time check to see if a keyword is supported?

I tried:

#ifndef override
    #define override
    #ifdef BUILD_WINDOWS
        #pragma message("The \"override\" keyword is not supported on this compiler!  Ignoring it!")
    #else
        #warning "The \"override\" keyword is not supported on this compiler!  Ignoring it!"
    #endif
#endif

This doesn’t work, since “override” is not a symbol.

I would like something more general than simply checking the compiler version to see if it is one of the ones that supports the keyword. How can this be done, if at all?

  • 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-17T06:35:42+00:00Added an answer on June 17, 2026 at 6:35 am

    I know of no way to check for specific keywords from within the program. The best I can offer is checking special predefined macros for specific compilers / compiler versions or language / language versions.

    For the former, there is

    #if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
    

    For the latter, there is

    #if __cplusplus >= 201103L
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am compiling my program that will run on linux gcc 4.4.1 C99. I
I'm compiling a program on my 64bit machine, but I'm not sure if it
I'm getting illegal use of floating point error on compiling the following program. Please
I have a piece of templated code that is never run, but is compiled.
I'm using Delphi 2009. My program has been compiling and running fine. I use
I receive an error compiling a C++ program in which of the lines makes
Background I am trying to build a Java program that make use of an
I have a build error in a c sharp program that I am compiling
So I take my C++ program in Visual studio, compile, and it'll spit out
I have problems compiling a D program that uses SDL using a makefile called

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.