How to link C++ object files with ld

If you run g++ with the -v flag, you’ll see the link line it uses. Here’s a simple example program: #include <iostream> int main(void) { std::cout << “Hello, world!” << std::endl; return 0; } And the output from running g++ -v -o example example.cpp: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v –with-pkgversion=’Ubuntu/Linaro 4.4.4-14ubuntu5.1′ … Read more

Implicit conversion failure from initializer list

The indirect initialization syntax with a braced-init-list your code is using is called copy-list-initialization. The overload resolution procedure selecting the best viable constructor for that case is described in the following section of the C++ Standard: ยง 13.3.1.7 Initialization by list-initialization [over.match.list] When objects of non-aggregate class type T are list-initialized (8.5.4), overload resolution selects … Read more

Using libstdc++ compiled libraries with clang++ -stdlib=libc++

What you’re seeing is the use of inline namespaces to achieve ABI versioning. What that means: The libstdc++ std::string is a different data structure than the libc++ std::string. The former is a reference counted design, whereas the latter is not. Although they are API compatible, they are not ABI compatible. That means that if you … Read more

Is gcc 4.8 or earlier buggy about regular expressions?

Locked. Comments on this answer have been disabled, but it is still accepting other interactions. Learn more. <regex> was implemented and released in GCC 4.9.0. In your (older) version of GCC, it is not implemented. That prototype <regex> code was added when all of GCC’s C++0x support was highly experimental, tracking early C++0x drafts and … Read more