Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

sdcc pic16 compiler linker

tymop
2009-03-19
2013-03-12
  • tymop
    tymop
    2009-03-19

    Dear all,

    I made a post where I said I have a problem with the float. But The problem is other:
    I think the problem is between the c compiler and the linker (there is no problem when I call a function from a header in the test.c folder, but there is a problem when I call a function coming from the sdcc's headers) :
    I make a test.c file. This is the content:

    #include <string.h>
    #include <pic18f252.h>

    char str1[10];

    void main(void) {
        strcpy(str1, "testing");
        }

    when I compile : no problem:
    `"C:\Program Files\SDCC\bin\sdcc.exe" test.c -c -mpic16 -p18F252`

    but when I call the linker : it does not work:
    `"C:\Program Files\SDCC\bin\sdcc.exe"  "Z:\essai\test.o" -o"test.HEX" -mpic16 -p18F252`
    message: using default linker script "C:\Program Files\gputils\lkr\18f252.lkr"error: missing definition for symbol "_strcpy", required by "Z:\essai\test.o"

    So, what is the problem? How can I resolve it?
    I think the problem is the linker does not look at the folder with it's functions, but I don't know how I can say it to look at the good folder.

    Can anybody help me?

     
    • Mark Bryars
      Mark Bryars
      2009-07-10

      I had this problem too,
      it reads #pragma library lines in the headers to determine what libs to link if you compile it in a one go, but if you link separately you need to specify the libs

      sdcc  test.o -otest.hex -mpic16 -p18f252 -llibc18f.lib