Jump to content

Program Compiles, but does not load

Recommended Posts

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



Link to post
Share on other sites

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...

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...