如何在QNX 6.5.0上编译googleTestLibrary?

时间:2015-10-12 09:13:47

标签: build googletest qnx qnx-neutrino

我想在QNX上编译google Test Library。但我没有成功。我尝试了一切。可以看到我的编译错误

是否有人为我分享 libGoogleTest_g.a libGoogleTest.a 文件?

D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `_M_initialize_dispatch<const char* const*>':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/ext/new_allocator.h:87: undefined reference to `std::__throw_bad_alloc()'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `operator<< <char, std::char_traits<char>, std::allocator<char> >':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/bits/basic_string.h:2506:
 undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): 
In function `ValueHolder':
/usr/qnx650/target/qnx6/usr/include/c++/4.4.2/ext/new_allocator.h:87: undefined reference to `std::__throw_bad_alloc()'
D:/ETCT_PROJECTS/CommonLibrary/Test/ETCCommon/Common/QNXUnitTests/../../../../GoogleTestLibrary/lib\libgoogleTest_g.a(gtest-all.o): In function `~DeathTestImpl':
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/home/emres/GoogleTest/./src/gtest-death-test.cc:374:
 undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'

1 个答案:

答案 0 :(得分:0)

检查此链接以修复编译问题。 https://code.google.com/p/googletest/issues/detail?id=444 修复编译问题后,请按照以下步骤创建静态库文件。

  • 为所有配置生成gtest-all.o目标文件(DEBUG RELEASE),只需打开QNX momentics并右键单击gtest-all.cc
  • 登录QNX,将gtest-all.o文件复制到任何目录
  • 输入复制文件的目录
  • 使用ar(archive)命令创建静态库,如下所示。

    DEBUG:ar -rv libgoogle_test_g.a gtest-all.o

    RELEASE:ar -rv libgoogle_test.a gtest-all.o

从QNX复制* .a文件并在项目中使用新的静态库