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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:55:25+00:00 2026-06-15T01:55:25+00:00

The following code compiles fine on Windows with Visual Studio: class_handle(base *ptr) : ptr_m(ptr),

  • 0

The following code compiles fine on Windows with Visual Studio:

class_handle(base *ptr) : ptr_m(ptr), name_m(typeid(base).raw_name()) { signature_m = CLASS_HANDLE_SIGNATURE; }

If I try to compile the same code on Linux I get:

error: ‘const class std::type_info’ has no member named ‘raw_name’

as far as I understand, raw_name is a Microsoft specific implementation. How do I have to change my code so it compiles both on Windows and Linux systems?

EDIT1 I prefer to not modify the original code, I just need a workaround to compile with gcc. Is that possible?

EDIT2 will #define raw_name name do the trick?

  • 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-15T01:55:26+00:00Added an answer on June 15, 2026 at 1:55 am

    Write these:

    // for variables:
    template<typename T>
    char const* GetRawName( T unused ) { ... }
    // for types:
    template<typename T>
    char const* GetRawName() { ... }
    

    with different implementation on Windows and not-on-Windows using an #ifdef block on a token you know to be defined in the microsoft compiler, but not in your other compiler. This isolates the preprocessing differences between MS and non-MS compiled versions to an isolated file.

    This does require a minimal amount of change to the original code, but does so in a way that will still compile on the microsoft compiler.

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

Sidebar

Related Questions

I came across the following code that compiles fine (using Visual Studio 2005): SomeObject
The following code compiles fine on majority of compilers (include Microsoft Visual Studio's -
the following code compiles with Visual Studio 2008 but not with g++ on Mac
The following source code compiles correctly with Visual Studio 2010: namespace NS { class
Visual Studio 2008 I am using the following source code that compiles ok using
The following code compiles in Visual C++ and gcc, but fails with Code Warrior
I have the following code which assembles and runs fine on Windows XP 32
The following code snippet compiles just fine on Mac OS X with gcc, but
According to my memory the following piece of code should compile fine on C++
I have the following code that compiles and works well: template<typename T> T GetGlobal(const

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.