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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:03:18+00:00 2026-06-12T03:03:18+00:00

I recently spent a fairly substantial amount of time tracking down a problem that

  • 0

I recently spent a fairly substantial amount of time tracking down a problem that turned out to be caused by compiling a library with -D_GLIBCXX_DEBUG (which tells libstdc++ to use a debug version of the standard library with extra checks) but compiling the client program without. This caused an ABI compatibility problem.

Is there some way I can automatically detect problems like this with GCC? Visual Studio provides the detect_mismatch pragma which I think would have served this purpose, but I’m unaware of any GCC equivalent. GCC does something with embedding a symbol name (e.g. GLIBCXX_3.4.9), and I can imagine schemes that would cause a linking error because of an undefined symbol if a corresponding symbol (e.g. mylib_debug_stl) were not present, but the only ways I can think of to get a use of that symbol are really hacky.

Alternatively, how do other people avoid this issue? Build the checked version of the library to a different name or something like that?

  • 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-12T03:03:20+00:00Added an answer on June 12, 2026 at 3:03 am

    Is there some way I can automatically detect problems like this with GCC?

    Only the linker can detect if you link incompatible code, not the compiler.

    The alternative linker, gold, can detect some problems with the --detect-odr-violations option.

    Alternatively, how do other people avoid this issue? Build the checked version of the library to a different name or something like that?

    I just ensure I rebuild everything when I want to use the Debug Mode, I don’t think I’ve ever wanted to keep a library around that was built with Debug Mode. It’s meant for debugging, not for normal use.

    I rarely use -D_GLIBCXX_DEBUG anyway, I more often do something like:

    #if 0
    # include <debug/vector>
    namespace my_class_stl = __gnu_debug;
    #else
    #include <vector>
    namespace my_class_stl = std;
    #endif
    
    struct my_class
    {
      typedef my_class_stl::vector<int> container;
      typedef container::iterator iterator;
      // ...
    };
    

    Then I change the preprocessor condition when I want to use a Debug Mode vector for that specific class, without affecting every container in the program. Because the change involves writing to the file (and so updating its timestamp) anything that depends on that header will get rebuilt by make, and there are two distinct types, std::vector<int> and __gnu_debug::vector<int>, which have different symbols and can’t be confused by the linker.

    Just defining _GLIBCXX_DEBUG doesn’t cause all dependencies to be rebuilt, and silently alters the definition of std::vector globally, rather than changing specific containers to a different type with a different name, __gnu_debug::vector

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

Sidebar

Related Questions

I recently spent a long while debugging something that turned out to be an
I recently spent a great deal of time pulling out a stored procedure back-end
I recently spent some time hunting down a typo in my C++ templates. g++
Having spent a bunch of time recently doing 2D work that involves pixel manipulation
I recently spent some time trying to write some numbers as bytes to pipe
Recently I spent quite some time writing various Visual Studio Extensions projects. Even though
I recently spent some time chasing an annoying little bug and I'm looking for
I spent a lot of time recently reading about debugging. One of the aspects
So I've spent a lot of time making an iPhone game and have recently
I've spent a fair bit of time with PHP & Python frameworks and recently

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.