# QNX SDP 8 Compiler flag \`-lang-c++\` now marked as deprecated

**URL:** <https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695>\
**Category:** Code\
**Tags:** os:qnx\
**Created:** [October 6, 2024, 8:05pm UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695 "2024-10-06T20:05:00Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [August 4, 2025, 12:24am UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/21 "2025-08-04T00:24:23Z")

</div>

The flag is added because of a CMake bug long ago where `CXX=qcc` would work even though it should have been rejected. See [this commit message](https://gitlab.kitware.com/cmake/cmake/-/commit/3151024d241c581463d20bf0ce3d1060bdd22de4). It refers to [this commit](https://gitlab.kitware.com/cmake/cmake/-/commit/e00db59d6c3f1c519f0f0d7a359d6d1be396b255) which introduced the bug.

---

<div class="post-metadata">

**Author:** ![jcurl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jcurl/32/4992_2.png) [@jcurl](https://discourse.cmake.org/u/jcurl)\
**Post date:** [August 4, 2025, 6:38am UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/22 "2025-08-04T06:38:19Z")

</div>

The commit description refers to having `-lang-c++` if `qcc` is used which is true. Why not have users provide the proper compiler name of `q++` where the option is not needed? The option `-lang-c` was never provided for `qcc` where that is the default.

---

<div class="post-metadata">

**Author:** ![jcurl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jcurl/32/4992_2.png) [@jcurl](https://discourse.cmake.org/u/jcurl)\
**Post date:** [August 4, 2025, 6:43am UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/23 "2025-08-04T06:43:39Z")

</div>

I think what also helps, is that today, since QNX 7.0 and later, the compiler only exists as a cross compiler. So a user must always provide a CMake toolchain file. I am suspecting the commit made 11 years ago was trying to cater compiling locally where `qcc` may have been seen as the default compiler when running on the host `nto` which is not possible anymore due to lack of support in the gnu toolchain.

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [August 4, 2025, 2:10pm UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/24 "2025-08-04T14:10:51Z")

</div>

> [@jcurl](#):
>
> The commit description refers to having `-lang-c++` if `qcc` is used which is true. Why not have users provide the proper compiler name of `q++` where the option is not needed?

Because of CMake’s backwards compatibility guarantees. We made a mistake in `qcc` support when adding C++ support that allowed `qcc` to work there…so in order to not break such usage, we continue to do so. We could make a policy to fix it once and for all, but the extra flag is probably less work…but such a patch would probably be welcome (though policies that live at the toolchain level are not “simple”).

> [@jcurl](#):
>
> I think what also helps, is that today, since QNX 7.0 and later, the compiler only exists as a cross compiler. So a user must always provide a CMake toolchain file. I am suspecting the commit made 11 years ago was trying to cater compiling locally where `qcc` may have been seen as the default compiler when running on the host `nto` which is not possible anymore due to lack of support in the gnu toolchain.

Perhaps it was supporting running `qcc` on QNX itself?

---

<div class="post-metadata">

**Author:** ![jcurl](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jcurl/32/4992_2.png) [@jcurl](https://discourse.cmake.org/u/jcurl)\
**Post date:** [August 4, 2025, 2:16pm UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/25 "2025-08-04T14:16:15Z")

</div>

Back in QNX 6.x, you could run self hosted. Then if CMake was also running self hosted I can imagine it finding the `CXX` as `qcc`. That was about 10 years ago.

QNX never runs self hosted anymore since 7.0, so whatever is done here will never run in QNX self hosted. So you _must_ provide a toolchain file and there’s no guessing anymore. A toolchain file must do that in the docs so the user could be reasonably expected to already provide the correct compiler name and the correct options.

So like in a previous comment, I don’t think you have to worry about `qcc` being used for compiling C++.

---

<div class="post-metadata">

**Author:** ![elahav](https://discourse.cmake.org/user_avatar/discourse.cmake.org/elahav/32/4150_2.png) [@elahav](https://discourse.cmake.org/u/elahav)\
**Post date:** [August 4, 2025, 5:08pm UTC](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695/26 "2025-08-04T17:08:16Z")

</div>

I have just tried this on a QNX 8 machine with self-hosted tools. CMake first looks for `c++`, then `g++`. Since I have both (with `c++` being a symlink to `g++`) this just works. If I want it to use `q++` then passing `CMAKE_CXX_COMPILER=q++` works.

```auto
elahav@meddle:~/src/cmake_example/build$ cmake -DCMAKE_CXX_COMPILER=q++ ..
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- The C compiler identification is QCC 12.2.0
-- The CXX compiler identification is QCC 12.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /system/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /system/bin/q++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (0.3s)
-- Generating done (0.0s)
-- Build files have been written to: /data/home/elahav/src/cmake_example/build
elahav@meddle:~/src/cmake_example/build$ cmake --build . --verbose
Change Dir: '/data/home/elahav/src/cmake_example/build'

Run Build Command(s): /system/local/bin/cmake -E env VERBOSE=1 /system/bin/make -f Makefile
/system/local/bin/cmake -S/data/home/elahav/src/cmake_example -B/data/home/elahav/src/cmake_example/build --check-build-system CMakeFiles/Makefile.cmake 0
/system/local/bin/cmake -E cmake_progress_start /data/home/elahav/src/cmake_example/build/CMakeFiles /data/home/elahav/src/cmake_example/build//CMakeFiles/progress.marks
/system/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/data/home/elahav/src/cmake_example/build'
/system/bin/make -f CMakeFiles/app.dir/build.make CMakeFiles/app.dir/depend
make[2]: Entering directory '/data/home/elahav/src/cmake_example/build'
cd /data/home/elahav/src/cmake_example/build && /system/local/bin/cmake -E cmake_depends "Unix Makefiles" /data/home/elahav/src/cmake_example /data/home/elahav/src/cmake_example /data/home/elahav/src/cmake_example/build /data/home/elahav/src/cmake_example/build /data/home/elahav/src/cmake_example/build/CMakeFiles/app.dir/DependInfo.cmake "--color="
make[2]: Leaving directory '/data/home/elahav/src/cmake_example/build'
/system/bin/make -f CMakeFiles/app.dir/build.make CMakeFiles/app.dir/build
make[2]: Entering directory '/data/home/elahav/src/cmake_example/build'
[-150%] Building CXX object CMakeFiles/app.dir/main.cc.o
/system/bin/q++ -Wp,-MD,CMakeFiles/app.dir/main.cc.o.d -Wp,-MT,CMakeFiles/app.dir/main.cc.o -Wp,-MF,CMakeFiles/app.dir/main.cc.o.d -o CMakeFiles/app.dir/main.cc.o -c /data/home/elahav/src/cmake_example/main.cc
[-150%] Linking CXX executable app
/system/local/bin/cmake -E cmake_link_script CMakeFiles/app.dir/link.txt --verbose=1
/system/bin/q++ CMakeFiles/app.dir/main.cc.o -o app 
make[2]: Leaving directory '/data/home/elahav/src/cmake_example/build'
[-150%] Built target app
make[1]: Leaving directory '/data/home/elahav/src/cmake_example/build'
/system/local/bin/cmake -E cmake_progress_start /data/home/elahav/src/cmake_example/build/CMakeFiles 0
elahav@meddle:~/src/cmake_example/build$ ./app 
Hello World!

```

[Previous page](https://discourse.cmake.org/t/qnx-sdp-8-compiler-flag-lang-c-now-marked-as-deprecated/12695.md?page=1)
