# QNX CMake Build

**URL:** https://discourse.cmake.org/t/qnx-cmake-build/1309
**Category:** Usage
**Tags:** os:qnx
**Created:** [June 2, 2020, 10:07pm UTC](https://discourse.cmake.org/t/qnx-cmake-build/1309 "2020-06-02T22:07:00Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![developer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@developer](https://discourse.cmake.org/u/developer)
#### Post date: [June 2, 2020, 10:07pm UTC](https://discourse.cmake.org/t/qnx-cmake-build/1309/1 "2020-06-02T22:07:00Z")

</div>

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](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-qnx)).

```auto
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?

---

<div class="post-metadata">

### Author: ![cristianadam](https://discourse.cmake.org/user_avatar/discourse.cmake.org/cristianadam/32/124_2.png) [@cristianadam](https://discourse.cmake.org/u/cristianadam)
#### Post date: [June 4, 2020, 10:34am UTC](https://discourse.cmake.org/t/qnx-cmake-build/1309/2 "2020-06-04T10:34:25Z")

</div>

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](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.

---

<div class="post-metadata">

### Author: ![developer](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@developer](https://discourse.cmake.org/u/developer)
#### Post date: [July 6, 2020, 5:36pm UTC](https://discourse.cmake.org/t/qnx-cmake-build/1309/3 "2020-07-06T17:36:07Z")

</div>

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.

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

```

or

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

```
