Linking Shared Libraries in Momentics


I’m using Momentics 6.2.1B and I am trying to get a program to compile with a shared library. The dll is a .so file with a couple of headers that I have included. Momentics gives me a compile error of “undefined reference to…” and then the dll functions I’m calling.

I’ve been told that this means I havn’t linked to the library, but from what I’ve dug up in the QNX docs apparently dynamic linking is automatic.

If someone could point me in the right direction that would be great. Im not too familiar with makefiles, and I havn’t changed them from the standard ones generated by “QNX C Project” so this may likely be part of the problem.


are you sure you actually have the library installed on your machine, and that the path to it is in $LD_LIBRARY_PATH ?


I checked $LD_LIBRARY_PATH- it is correctly set to where the libraries are actually located. Is this all that is supposed to be necessary, as I’ve never worked with dll’s in qnx before.

The libraries compile in a demo version of the software in gcc, but when I try to include it in my own program using momentics, it won’t work.


when you compile with gcc by hand, I’m guessing you put -lnameoflib in the args to gcc, make sure that that is also in the gcc line created by Eclipse, or PhAB, whichever you’re using.

You still have to link against the library at compile time so that the tools know where the unresolved symbols are going to be coming from, and so the the proper dependancies can be inserted into the binary’s ELF header. At runtime it will get loaded.

Correct me if I’m wrong, but I would do this by going into the properties for the project and changing the C/C++ Build Command from its default to something like:


Just so I know, what is the the build command when you select the default checkbox (or what file would I look in to figure this out)??