So, here's the thing. To develop plugins for Maya on Linux, we have to compile with GCC 4.1.2. But this compiler doesn't support any of the new C++0x features.
would it be possible to do something like this:
gcc-4.6 -o test.cpp.o -c test.cpp
gcc-4.1.2 -o exec_test test.cpp.o
I have serious doubt it would be possible, but worth asking.
If this is not possible, is there a way to achieve something similar ?
The ABI for those two GCC versions is compatible, the problem is that the object compiled by GCC 4.6 might depend on symbols that are only defined by the newer GCC's C++ standard library (e.g. if you use the
std::fstream
constructor taking astd::string
your object will have a dependency on that symbol, which is only present in recent versions of GCC that support C++11.)It will work as long as you link to the libstdc++ from GCC 4.6 (which is
libstdc++.so.6.0.16
) i.e. by linking with-L /path/to/gcc-4.6/lib
You must also ensure that newer version of the library is found at run-time, i.e. by telling the dynamic loader to use that library, using one of the methods listed in the libstdc++ manual
For example: