This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS: how to add correctly the library t the CCS project?

Tool/software: Code Composer Studio

I need to add a library on a CCS project.
I do right click on the project, Add Files from project's context menu, browse and select the .c and .h files.
In the .c file where I will call the functions of the added library I included the .h file of the added library.
Then I have this problem:
when I build the the project the called functions from the added library are not solved.

how to add correctly the library t the CCS project?

  • Hello!

    Library binary is specified in Linker page of CCS Build option group.

  • Hi, Thanks very much for oyur anwer

    Only I need to add myfile.c and myfile.h to CCS project.
    The building give me error. The called functions of the myfile.c are unsolved.

    The error say symbol unsolved.


    Sincerely, thanks very much.

  • Hello!

    I would suggest to skim through "Introduction to the Software Development Tools" clause of compiler user guide, which also has nice illustration of each part in the process.

    Let me describe application building process in somewhat simplified way, which I hope might give you idea.

    Your project may contain source files, say C files. Compiler translates those files into object files. Object files are simply collection of binary modules, each of them representing every function in your source. These binary code cannot be executed at this point, they exist just as unconnected pieces. Later, on linking stage linker combines all required code pieces into application. Sounds not that much different, but there is important job at this stage. Whenever some code makes call to other function, linker calculates and places address of callee to the call place. So this way linker establishes connections between pieces of code.

    Now there is a case when some binary codes where created not by your application. Typical examples are math libraries and alike. Rather than compiling sine code each time ourselves we use precompiled, binary libraries of object code. In that case input to linking stage consist of both objects, produces from your sources and objects in library. When we say 'library' we most of time assume so called "library of object files".

    For this step to succeed linker has to have library binary file at its hands. We tell that on linker options page, as I mentioned in my earlier message. This binary file is container of executable code.

    There is another side of the story. People often confuse header file with library itself. In most cases header file contains forward declarations of executable modules available elsewhere. So when you include library.h in your source.c, it tells compiler that if certain function is called, it has some certain signature. Then compiler knows how to arrange this function call in terms what type and how many arguments to prepare, what would be return value. However, at this stage executable code of callee is not needed. Say, if you're going to calculate sin(x), then compiler knows it have to prepare double argument, expect double return value. Later, at linking stage linker will substitute address of sin() function entry point. Once again, its executable code is stored in binary library, not header.

    So as a brief summary, to pass compile stage one have to include library's header file in source file, however, to pass linking stage one have to define library's binary as well.

    Hope this helps.

  • Hi, 

    Sincerely thanks very much for your answer detailed, it is very usefull for me !!!