sigurdk 0 Posted March 31, 2015 Share Posted March 31, 2015 I am trying to port an arduino project to energia. I use the pow( base, exponent) function in calculations to compute Standing Wave Ratio (SWR). I have a function swr that is called from loop. Works fine on arduino, but on energia I get the following load output: (notice "ld returned 1 exit status") \energia-0101E0014\hardware\tools\msp430\bin\msp430-gcc, -Os, -Wl,-gc-sections,-u,main, -mmcu=msp430f5529, -o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\LCD_Sharp_v3.cpp.elf, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\LCD_Sharp_v3.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\SPI\SPI.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\SPI\utility\eusci_spi.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\SPI\utility\usci_spi.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\SPI\utility\usi_spi.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\LCD_SharpBoosterPack_SPI\LCD_SharpBoosterPack_SPI.cpp.o, C:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp\core.a, -LC:\DOCUME~1\sigurd\LOCALS~1\Temp\build5374206321071163191.tmp, -lm] LCD_Sharp_v3.cpp.o: In function `swr(int, int)': LCD_Sharp_v3.cpp:(.text._Z3swrii+0x5a): undefined reference to `pow' collect2: ld returned 1 exit status I copied the same code to "setup" and it runs fine there. Any suggestions? Thank you, Sigurd KJ1k LCD_Sharp_v3.ino Quote Link to post Share on other sites
roadrunner84 466 Posted April 1, 2015 Share Posted April 1, 2015 pow() is part of the math library, I assume you #include <math.h>, but you'll also need to link to the math library itself, using the linker parameter -lm. I am not sure how to do this in Energia, but you'll probably end up with a binary that is way too large for your purposes. An alternative is to write your own pow() function... Quote Link to post Share on other sites
spirilis 1,265 Posted April 1, 2015 Share Posted April 1, 2015 Try powf() Sent from my Galaxy Note II with Tapatalk 4 energia 1 Quote Link to post Share on other sites
sigurdk 0 Posted April 1, 2015 Author Share Posted April 1, 2015 I tried Try powf(), as suggested and that solved my problem! Thank you very much KJ1K, Sigurd Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.