This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to create and link a library file to C source code

Hi,
I am trying to create a library file to make some of the functions generic.
I need to know how to create it and link it with my source code in C using uvision for c51 & 8051 developments.

Parents
  • Here are the details of the error I am getting, I have created a separate project where I have written a small function which accepts an integer value does some calculations and returns back the result. I have selected the target processor and in the project settings for output I have selected create library option. I have named this file as MyLib.c and I am able to generate a MyLib.Lib file after compiling the program.
    I am calling this function from my main project (program) where I have included this MyLib.lib file. The details of the Function and error are as under.

    int return_no(int value)
    {
    int i = value * 5;
    return(i);
    }
    I have named this file as MYLIB.C and in the project setting I have selected the target processor
    MYLIB.LIB(1): error C100: unprintable character 0xAC skipped
    MYLIB.LIB(1): error C100: unprintable character 0x07 skipped
    MYLIB.LIB(3): error C141: syntax error near '?'
    MYLIB.LIB(3): error C100: unprintable character 0x16 skipped
    MYLIB.LIB(3): error C100: unprintable character 0xC8 skipped
    MYLIB.LIB(3): error C100: unprintable character 0x08 skipped
    MYLIB.LIB(4): error C129: missing ';' before '?'
    MyLib.LIB(10): error C305: unterminated string/char const

    I have not exposed these details earlier because I wanted to know exactly how to create a lib file (is there any other way) and access it from the program.

    Thanks for the help

Reply
  • Here are the details of the error I am getting, I have created a separate project where I have written a small function which accepts an integer value does some calculations and returns back the result. I have selected the target processor and in the project settings for output I have selected create library option. I have named this file as MyLib.c and I am able to generate a MyLib.Lib file after compiling the program.
    I am calling this function from my main project (program) where I have included this MyLib.lib file. The details of the Function and error are as under.

    int return_no(int value)
    {
    int i = value * 5;
    return(i);
    }
    I have named this file as MYLIB.C and in the project setting I have selected the target processor
    MYLIB.LIB(1): error C100: unprintable character 0xAC skipped
    MYLIB.LIB(1): error C100: unprintable character 0x07 skipped
    MYLIB.LIB(3): error C141: syntax error near '?'
    MYLIB.LIB(3): error C100: unprintable character 0x16 skipped
    MYLIB.LIB(3): error C100: unprintable character 0xC8 skipped
    MYLIB.LIB(3): error C100: unprintable character 0x08 skipped
    MYLIB.LIB(4): error C129: missing ';' before '?'
    MyLib.LIB(10): error C305: unterminated string/char const

    I have not exposed these details earlier because I wanted to know exactly how to create a lib file (is there any other way) and access it from the program.

    Thanks for the help

Children