| undefined reference to (any function in libm.a) [message #1718549] |
Sat, 26 December 2015 21:02  |
Eclipse User |
|
|
|
Hi all
Working with Eclipse IDE for C/C++ Developers
Version Mars.1 Release(4.5.1)
Using arm's gcc cross compiler tools in Windows 7 and CDT's internal builder.
For the compiler I use gcc (prefixed with arm-none-eabi-) with the -c option to produce all the object files (*.o)
For the linker I use gcc as well with the appropriate -Wl, flag where needed.
The compiler pass went without incident but the linker pass would seemingly not link to libm.a
I kept getting "undefined reference to 'somemathfunc' in the console output. No matter where I placed -lm in the linker flags text box I still got the same error.
It finally dawned on me, after pouring over console output messages that -lm was always placed before the input files
The only way I found to get -lm after the input object files was to alter the "Command line pattern" from the default:
${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}
to:
${COMMAND} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS} ${FLAGS}
Surely I'm not the first one to try and link with libm.a or any other "none-standard" library?
Is there any other way of doing this as I fear placing all flag options at the end of the command line might bite me later on. I only want the -l option after the input object files, especially since after searching and searching I could not find anybody else on the net with a similar issue
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05998 seconds