Linking external library files in HI-tech compiler

Question: How can I link external library files in my project in HI-tech compiler?

 

Answer:

This can be done by manually adding your library files and path to the makefile definitions. In PSoC designer, the easiest way to do this is by adding a "local.mk" file to your project directory. Anything placed in this file automatically gets added to your makefile. This allows you to add your library and library path to the makefile without physically editing the makefile. Here is what you add to the file:

LIBS:=$(LIBS) yourlibraryname.a yourlibraryname2.a LIB_PATH:=$(LIB_PATH) C:/YourPathToLibrary

This simply appends your library name files to the library definition and adds your library path to the library path definition. You need to list all library files (space seperated) you will use in the LIBS definition. Please find sample local.mk file attached herewith. You can edit this file to match your project. You must have a .h file with all of your definitions and function prototypes for the library included in your project directory, or else your project still will not be able to use the library.

NOTE: The HiTech compiler is no longer available for PSoC Designer. Please view the HiTech to Imagecraft migration guide to understand the changes required to successfully transition your code base to the new compiler.