compiling and linking weak symbols

Hello all,

First of all, I’m new to QNX so please apologize if my question is obvious
(and please tell me why :wink:

I’m porting an existing C++ project to QNX 6.2.1 (x86 & ARM platforms) and I
felt into some troubles dealing with weak symbols.

I have this class which defines a lot of its methods as inline in the header
file. I’m compiling under QNX for Windows 2000 command line process (no
IDE). My compilation flags are :

QCC -V gcc_ntox86 -W
c,-O0,-fno-inline,Wall,-fno-weak,-fvolatile,-fno-builtin -I[include
paths] -c -o objectName.o sourceName.cpp

It looks like all the inline methods :

inline int GetLayersOffset () const
return mLayersOffset;
(mLayersOffset being a class member)

are defined as “weak” in the object file :

nm objectName.o | grep W
00000000 W GetLayersCount__C4CTPF
00000000 W GetLayersOffset__C4CTPF
00000000 W GetLayers__4CTPF

Actually, I didn’t notice it until the final link step where all the “weak”
symbols couldn’t be linked to the final application, thus raised a bunch of
“unresolved symbol” errors.

So my questions are :

  1. Why are the inline methods symbols declared as “weak” ?
  2. How to link all together the “weak” symbols and the final application ?

Thanks for any help

Paul Favale
VST - France