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.

Struggling beginner. How to include .h and .c library files.

Other Parts Discussed in Thread: PGA970

Hi,

I must be missing something as I am having great difficulty adding some proven source files to a new project. The project wil be using a PGA970.

The files are in a folder at R:\Projects\ED Projects\ED432 LVDT system\Texas Instruments code\PGA970GenericFirmware\PGA970_FW_Release_1_5_Generic\code\source

The sub folders are the standard ones that come with the PGA970 device:

chip, core, lib and oem

Each of these folders contain an inc folder wth all the headers plus the source code that goes with the header files. See zip file attached.

source.zip

I have spent many hours trying to figure out all the places that need to have these files referanced but without success.

I have tried doing the whole TMC4C123G launchpad workshop to get me aquainted with CCS but that doesn't seem to cover this situation.

Can anyone help?

Thanks in advance,

Nigel

  • Hi Nigel,

    Are you trying to add the PGA970 files to an already created project? Or are you trying to import the PGA970 project and add source files? 

    In either case the procedure is the same. You will use the import function to bring in a project first. Note that if the project files are already included in the workspace, you will get an error. I usually find it simplest to start a new workspace with a descriptive name, then import the project without copying the files into the workspace.

    Next, once the project is imported and opened in the workspace, you can right-click on the project folder and select "Add Files". Then simply add all of the files you need. The folder structure should not matter. As long as any header files that are included are also part of the project directory (added through the "Add Files" function), it should not have any trouble.

    Regards,

    Scott

  • Hi Scott,

    I gave up with the original inport of the PGA970 project as I could not untangle the links sufficiently to allow editing, versions and comprehension. Now the plan is to rebuild the whole project from scratch so that I can understand how CCS links things and to enable me to have full control over the code.

    I am still learning lots about CCS and complex C programs and have been somwhat spoilt by the simplicity of the Arduino IDE.

    At the moment I am having to put all my .h files in 1 folder while the .c files can be in a nice structure.

    If I try to put the .h files into sub folders the compiler fails to find them.

    Is there a tutorial I can work through that would help me understand how I should handle .h files?

    Thanks for your help.

    Best regards

    Nigel

  • Hi Nigel,

    There are a couple of ways to do this. You can either do as you've mentioned, and make sure your .h files (or anything that needs to be included in another file) are all in the base project directory, or you can add new search paths for included files.

    In the project explorer that you've shown in your screenshot, right click on the project name, and click "Properties" in the menu (or click Project->Properties on the menu bar). Next under Build->ARM Compiler->Include Options, you can find a place to enter search paths for subfolders. This will allow any file to find the .h files and include them as long as they're in the specified search paths.

    Here's an example:

    Regards,

    Scott