我正在尝试编译并使用Qt。出于某种原因,我必须为我的应用程序使用g ++版本3.4.3,而不是系统上安装的编译器:g ++ 4.1.2。 我编译了Qt,环境变量CXX和CC设置为旧的g ++,但是当我将我的应用程序与旧的g ++链接时,我得到以下错误:
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `typeinfo for std::exception@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__vmi_class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_begin_catch@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator delete[](void*)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator new(unsigned int)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for std::bad_alloc@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::bad_alloc::~bad_alloc()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_pure_virtual@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `typeinfo for std::bad_alloc@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__gxx_personality_v0@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::exception::~exception()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_throw@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::uncaught_exception()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `vtable for __cxxabiv1::__si_class_type_info@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator delete(void*)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_allocate_exception@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `operator new[](unsigned int)@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_rethrow@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::terminate()@GLIBCXX_3.4'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `__cxa_end_catch@CXXABI_1.3'
.../qt-4.7.1-lgpl/lib/libQtCore.so: undefined reference to `std::exception::what() const@GLIBCXX_3.4'
仅使用新的编译器和链接器成功链接可执行文件。
有没有人知道如何解决这个问题?
答案 0 :(得分:2)
事实证明修改LINK是不够的,但是当我将PATH更改为指向旧编译器时,Qt被编译并仅与旧编译器链接,然后我能够将其与我的程序链接。本来应该想到的......
答案 1 :(得分:0)
gcc 3.x和4.x没有兼容的C ++ ABI,甚至一些早期的4.x版本与最近的版本不兼容(阅读gcc 4.2 +)。