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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:13:02+00:00 2026-06-12T20:13:02+00:00

I use GoogleTest for testing my C++ projects, and after finding that precompiled libraries

  • 0

I use GoogleTest for testing my C++ projects, and after finding that precompiled libraries were no longer distributed in the Ubuntu package, I found the following on the project website:

If you compile Google Test and your test code using different compiler
flags, they may see different definitions of the same
class/function/variable (e.g. due to the use of #if in Google Test).
Therefore, for your sanity, we recommend to avoid installing
pre-compiled Google Test libraries. Instead, each project should
compile Google Test itself such that it can be sure that the same
flags are used for both Google Test and the tests.

What I take from this is that it’s a bad idea to compile GoogleTest separately from the project being testing. What I don’t understand is whether this is just a GoogleTest thing, or if this is a general thing for linking libraries.

Question

Is there any situation in which it is unsafe to link to precompiled third-party libraries, compiler flags or otherwise, and if not, what’s so special about GoogleTest?

  • 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-12T20:13:03+00:00Added an answer on June 12, 2026 at 8:13 pm

    There are some compiler flags, notably those that work with alignment, that could cause a problem.

    From GCC i386 and x86-64 flags

    -malign-double
    -mno-align-double

    Control whether GCC aligns double, long double, and long long variables on a two-word boundary or a one-word boundary. Aligning double variables on a two-word boundary produces code that runs somewhat faster on a Pentium at the expense of more memory.

    On x86-64, -malign-double is enabled by default.

    Warning: if you use the -malign-double switch, structures containing the above types are aligned differently than the published application binary interface specifications for the 386 and are not binary compatible with structures in code compiled without that switch.

    For example, using that flag on a 32-bit system will for doubles and long longs to be 64-bit aligned. If you compile a library without the flag, then attempt to use the library while using the flag, structures that contain the types above may have different alignments, and may not interoperate.

    Other (much simpler) cases can also be ensuring the same set of #defines to ensure the same function/structure/class definitions are used (and other such ODR violations). For example, the use of ‘–std=c++11’ in gcc, which enables the C++ 11 versions of the Standard Library classes, which in some cases are different than the previous versions.

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

Sidebar

Related Questions

Starting to use the googletest ASSERT_THROW clause, it seems that 'sometimes' the base type
I use GoogleMock/GoogleTest for testing, and I'm seeing some strange behavior when a matcher
I am curious as to what people use for unit-testing and memory-testing tags in
Use case: I find a piece of code that I do not understand at
I tried to use google test framework and can't see why the following code:
I am trying to use GoogleTest to test a simple function, but as I
use Image::Imlib2; my $a = Image::Imlib2->load(/foo/file); gives me the following error: Runtime error: Image::Imlib2
My need is simple. I have to compile and use googletest on windows using
Use Case Show a photo uploaded by the user in a square box with
use C#,want to upload excel file on google doc. bellow syntax use to upload

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.