Math library in IDE

Newbie question here.

I’m using QNX Neutrino 6.2.1 with the Momentics IDE. I have a C application
that needs to be compiled with the math library (for trig functions) and for
the life of me I can’t figure out how to tell the IDE to include the math
library.

For the record, here is the error message I get when I link. I’m using the
standard C function sin which is a macro to _Sin which the linker can’t
find. The compile step works fine. The problem is in the linker.

I appreciate any help on this matter.

/lib -LC:/QNXsdk/target/qnx6/ppcbe/usr/lib -EB
whet.o: In function main': whet.o(.text+0x34c): undefined reference to _Sin’
whet.o(.text+0x34c): relocation truncated to fit: R_PPC_REL24 _Sin

Matt Boothe <embeddedmatt@yahoo.com> wrote:

Newbie question here.

I’m using QNX Neutrino 6.2.1 with the Momentics IDE. I have a C application
that needs to be compiled with the math library (for trig functions) and for
the life of me I can’t figure out how to tell the IDE to include the math
library.

Look under “libraries” in the index for the IDE User’s Guide.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

I couldn’t find an index, let alone ‘libraries’ in the 6.2.1 Help. I did a
Search in the Eclipse Help but that didn’t point me at anything either.
Does an index actually exist somewhere?

For Matt: Right-click on the project: Properties | Linker | Category:
Extra Libs | Add. Then type ‘m’ in the Name box.

“Steve Reid” <stever@sreid.ott.qnx.com> wrote in message
news:d4679v$ba9$1@inn.qnx.com

Matt Boothe <> embeddedmatt@yahoo.com> > wrote:
Newbie question here.

I’m using QNX Neutrino 6.2.1 with the Momentics IDE. I have a C
application
that needs to be compiled with the math library (for trig functions) and
for
the life of me I can’t figure out how to tell the IDE to include the
math
library.

Look under “libraries” in the index for the IDE User’s Guide.


Steve Reid > stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Lisa,

Many thanks! I had actually followed all of your steps but I just didn’t
know to type “m” as the name of the library. I assume this must be common
knowledge among the UNIX folks but unfortunately for me my background is
embedded systems.

By the way, I did find an index in the IDE manual but there were only three
entries under ‘L’ and none of them helped.

QNX Momentics Professional Edition
-Integrated Development Environment
–User’s Guide
—Keyword Index

Thanks again,
Matt

Matt Boothe <embeddedmatt@yahoo.com> wrote:

Lisa,

Many thanks! I had actually followed all of your steps but I just didn’t
know to type “m” as the name of the library. I assume this must be common
knowledge among the UNIX folks but unfortunately for me my background is
embedded systems.

By the way, I did find an index in the IDE manual but there were only three
entries under ‘L’ and none of them helped.

QNX Momentics Professional Edition
-Integrated Development Environment
–User’s Guide
—Keyword Index

I looked at the 6.2.1 docs, and you’re right: it isn’t in the index. The
index is much better in the 6.3 docs. Sorry for sending you on a wild
goose chase.


Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems

Matt Boothe wrote:

I’m using QNX Neutrino 6.2.1 with the Momentics IDE. I have a C application
that needs to be compiled with the math library (for trig functions) and for
the life of me I can’t figure out how to tell the IDE to include the math
library.

If you’ve got a QNX C Project, in the project Properties dialog, add
-lm to the Linker tab’s options list.

If you’ve got a Standard C Project, add this near the top of the Makefile:

LDFLAGS+=-lm


Chris Herborth (cherborth@qnx.com)
Never send a monster to do the work of an evil scientist.

I have a similar error, please help!

/tmp/AAA535454_cc.o: In function ‘main’:
/tmp/AAA535454_cc.o (.text+0x19):undefined reference to ‘tan’
cc:/usr/bin/ntox86-ld error 1

podenko <sorando@mixmail-dot-com.no-spam.invalid> wrote:

I have a similar error, please help!

/tmp/AAA535454_cc.o: In function ‘main’:
/tmp/AAA535454_cc.o (.text+0x19):undefined reference to ‘tan’
cc:/usr/bin/ntox86-ld error 1

-lm

Or, add m as a library for a QNX project, in project properties,
QNX Project properties, linker tab, extra libraries page (from the
selection box near the top).

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com