QNX CMake Build

Hello,

I am getting undefined errors like the following when using the qnx toolchain file from the docs (https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx).

qnx700/target/qnx7/usr/include/c++/5.4.0/iostream:74: undefined reference to `std::ios_base::Init::~Init()'
qnx700/target/qnx7/usr/include/c++/v1/memory:3777: undefined reference to `std::__1::__shared_weak_count::~__shared_weak_count()'
 undefined reference to `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()'

It’s like the std library isn’t being linked in automatically… any thoughts?

QNX 7.0 comes with two standard libraries. Have a look at http://www.qnx.com/developers/docs/7.0.0/index.html#com.qnx.doc.qnxsdp.migration/topic/cpp_apps.html to find out how to configure your compiler flags.

1 Like

Thanks for the info. In my case my libraries were requiring the GNU library so I was able to use either of the following to fix my problem.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Y_gpp")

or

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")