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.
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
You cannot include a lib into a compiler source. Once you have created a library file, you may add this library file to another project just in the same way as you add source files to a project. Reinhard
As Reinhard says, you cannot compile a Library! A Library contains compiled object code - it is not a 'C' source file! A Library provides an input to the Linker - not to the compiler! Look at the Diagram of the "Software Development Cycle" in Chapter 1 of the uVision-2 Getting Started Guide (p13 in the 02.2001 version).