Choosing the version of the OS
The QNX Momentics Tool Suite lets you install and work with multiple versions of Neutrino. Whether you're using the command
line or the IDE, you can choose which version of the OS to build programs for.
Making your code more portable
To help you create portable applications, QNX Neutrino lets you compile for specific standards and include QNX- or Neutrino-specific
code.
Header files in /usr/include
The ${QNX_TARGET}/usr/include directory includes at least the following subdirectories (in addition to the usual sys):
Self-hosted or cross-development
In the rest of this chapter, we'll describe how to compile and debug a Neutrino system. Your Neutrino system might be anything
from a deeply embedded turnkey system to a powerful multiprocessor server. You'll develop the code to implement your system
using development tools running on the Neutrino platform itself or on any other supported cross-development platform.
Using libraries
When you're developing code, you almost always make use of a library — a collection of code modules that you or someone else has already developed (and hopefully debugged). Under Neutrino, we
have three different ways of using libraries:
Linking your modules
To link your application against a library, use the -l option to qcc, omitting the lib prefix and any extension from the library's name. For example, to link against libsocket, specify -l socket.
Optimizing the runtime linker
The runtime linker supports the following features that you can use to optimize the way it resolves and relocates symbols:
Debugging
Now let's look at the different options you have for debugging the executable. Just as you have two basic ways of developing
(self-hosted and cross-development), you have similar options for debugging.
A simple debug session
In this example, we'll be debugging our "Hello, world!" program via a TCP/IP link. We go through the following steps:
Debugging using libmudflap
QNX includes support for Mudflap through libmudflap. Mudflap provides you with pointer checking capabilities based on compile time instrumentation as it transparently includes
protective code to potentially unsafe C/C++ constructs at run time.