Question

I already know that it's unsafe to naively link g++4.4 c++98 object files with g++4.7 c++11 object files, but I see mixed opinions on the web about g++4.8. While the object file formats are mutually compatible, libstdc++ isn't, and in bad ways.

Is it safe to blindly link a g++4.4 -std=gnu++98 object file against another object file compiled with g++4.8 with -std=c++11 or -std=gnu++11? If so, why is it safe when doing the same with g++4.7 wasn't; furthermore, does this mean that g++4.7 with -std=c++11 is incompatible with g++4.8 with -std=c++11?

Was it helpful?

Solution

The answer is yes per the answer to this previous question g++ always backward-compatible with "older" static libraries?

Basically the answer says that you can link from C++11 to C++98 from 3.4 - 4.8 (but not 4.7.1). You can only link C++11 to C++11 using the same version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top