That's odd... piklab gives it a couple of extra options and runs it in more then one step... the commands and output (on exaclty the same code as in your post):

sdcc -mpic16 -p18f2550 -V --debug -I/home/LuitvD/electronics/ -c test.c
test.c:5: 'auto' variable 'x' may be used before initialization
test.c:5: 'auto' variable 'x' may be used before initialization
+ "/usr/local/bin/sdcpp" -nostdinc -Wall -std=c99 -I"/home/LuitvD/electronics/" -Dpic18f2550 -D__18f2550 -DSTACK_MODEL_SMALL -obj-ext=.o -DSDCC_MODEL_SMALL -DSDCC=263 -DSDCC_pic16 -D__pic16 -I"/usr/local/bin/../share/sdcc/include/pic16" -I"/usr/local/share/sdcc/include/pic16" -I"/home/LuitvD/electronics/"  " test.c"
+ "gpasm" -DSDCC_MODEL_SMALL -Dpic18f2550 -D__18F2550 -DSTACK_MODEL_SMALL -g -c "test.asm" -o "test.o"
sdcc -mpic16 -p18f2550 -V --debug -Wl-c -o test.hex test.o
message: using default linker script "/usr/share/gputils/lkr/18f2550.lkr"
error: missing definition for symbol "_sinf", required by "test.o"
+ "gplink" -I"/usr/local/bin/../share/sdcc/lib/pic16" -I"/usr/local/share/sdcc/lib/pic16"  -c  -w -r -o test.hex  test.o  crt0i.o pic18f2550.lib libsdcc.lib
*** Exited with status: 1 ***

Looks like piklab calls the wrong options... wants it done in small steps, not remembering to pass on the data of the first step on to the next.
Compiling with the options you use (-mpic16 -pp18f2550) does work corecctly...

The most annoying thing is that I can't change the way piklab uses SDCC...
Thanks for the help anyway, I'll go bug the people at PikLab ;)

Luit van Drongelen

2007/2/6, Ernst Bachmann <>:
On Dienstag, 6. Februar 2007, Luit van Drongelen wrote:
> Allright, seems like I finally found my problem... somehow the compiler
> refuses to pass the linker the used/required libraries. Adding -l
> libm18f.lib to my linker options in piklab Fixes everything... Does anybody
> know why this doesn't happen automatically, or is this a problem caused by
> piklab, not sdcc?

Thats strange, does piklab have an way to display the command line options it
uses to invoke sdcc?

Here's how I tested:

#include "math.h"

int main() {
float x;
return sinf(x);
compile using:
# sdcc -mpic16 -pp18f2550 test.c
test.c:5: warning 84: 'auto' variable 'x' may be used before initialization
test.c:5: warning 84: 'auto' variable 'x' may be used before initialization
message: using default linker script "/usr/share/gputils/lkr/18f2550.lkr"
gives me a nice 19kb .HEX file, with the math functions for sin embedded.

Maybe also try to update gputils to a recent version?
# gplink -v
gplink-060819 alpha

> > I just added the 31 december snapshot (removes my ability to program to
> > PIC18F4431, which I added myself) and it still gives me the same error;

Thats easy to fix: Just post your changes to the developers, and the next
snapshot might contain that device already ;)


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
Sdcc-user mailing list