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.

undefined symbol / unresolved symbol

Other Parts Discussed in Thread: CONTROLSUITE

Hello,

I created a new project in CCS V5.  I have header files that declare variables and these header files are included in the c source files.  When the linker runs, I get errors for all my symbols.  The console shows them as "undefined symbol" and the problem window shows them as "unresolved symbol".  In the header files, the variables are declared as extern.

The header files are in my project.

Can you please tell me what I am doing wrong?  Thank you.

Lettie

  • H Lettie,

    very commonly these types of errors are from issues with include paths and variables.    Have a look at this wiki, which I hope helps.

    http://processors.wiki.ti.com/index.php/Include_paths_and_options

    Please keep us informed.

    Best Regards,
    Lisa

  • Hi Lisa,

    Thank you for the prompt reply.  I reviewed the wiki and I believe I have done all that it recommends.  The header files & source files (.h & .c) were added directly to the project.  And when I use windows explorer I see that the header and source files are in the workspace project.

    The "unresolved symbol" error shows up when "Invoking ARM LInker".  I noticed that I have unresolved symbols for both our company's "application specific" variables and TI variables such as "GPIOPinTypeSSI".

    For "includes" I have:

    c:/ti/ccsv5/tools/compiler/tms470_4.9.5/include

    c:/ti/controlSUITE/device_support/f28m35x/v140/Mware

    And within the workspace project I "added" files,  using "copy files".  The files are header & source (.h and .c).

    (BTW - is it better to do "Link to files" instead of "copy files"?) 

    Thank you,

    Lettie

  • Hello Again,

    I deleted my project from the workspace and then created a new one.  I followed the directions from the following wiki on portable projects:

    processors.wiki.ti.com/index.php/Portable_Projects

    I still have the link errors, unresolved symbol.  I included some screenshots of my set-up.  Any tips on what I've done wrong?  Thank you!  From, Lettie.

  • Hi Lettie,

    is this your own code where you are trying to use libraries from ControlSUITE?  Or are you using an example/trying to use an example.   What if you include your top level control suite folder in the include paths. 

    In general linking and copying depends I would say on your use scenario and project size and complexity.  For example if you are keeping many different libraries and/or using source control, you might find linking more convenient.  If you keep local isolated smaller projects, copying is possibly a better option.  The important thing is to understand how to handle them differently.

    Do you see any errors with an unmodified example?

    Best Regards,

    Lisa

  • Hi Lisa,

    Yes, this is my own code and yes I'm trying to use libraries/APIs from ControlSUITE.  (I have used unmodified examples and all goes well.  No errors.)  This is my first attempt at creating a new project.

    I just tried your suggestion.  In the project properties, under C/C++ Build, Build Variables, I made a new variable "TI_V140" which is "c:\ti\controlSUITE\device_support\f28m35x\v140.  Then under CCS Build, ARM Linker, File Search Path, I added "${TI_V140}" to the search path.  Still have same unresolved symbol errors.

    Thanks again for your time & assistance.

    Lettie

  • Hi Lisa,

    One more thought.  Should I have added the TI source files from MWARE/driverlib and MWARE/inc,  via "link to files", for this "create new" project?  I assumed that the linker would find them through a search path.  Was that assumption incorrect?

    Thank you,

    Lettie

  • Hi Lettie,

    yes give that a try.

    Best Regards,
    Lisa

  • Lettie,

    let me send you or find instructions on using these libraries independently.  It may be tomorrow.

    Best Regards,

    Lisa

  • Lettie,

    also note linked files use path variables as described in the wiki and not build variables (as you showed)

    Best Regards,
    LIsa

  • Hi Lettie,

    these will be some useful resources for you:

    http://www.ti.com/lit/ml/sprugu2b/sprugu2b.pdf

    http://processors.wiki.ti.com/index.php/Linking_folders_to_a_project

    Best Regards and keep us informed,

    Lisa

  • Lettie - you are missing several libraries during the linking stage. hence the unresolved symbols errors. For example, I believe GPIOPinTypeSSI is part of controlSUITE's driverlib.

    I didn't see a lot of specific libraries listed in your linker options screenshot. They must be defined in your linker command file. Check it and make sure the correct libraries are being pulled in there. If not, use all the suggestions by Lisa to make sure you are pulling in what you need.

    Thanks

    ki

  • Hello Lisa & Ki,

    I have made progress but still have trouble.  I linked TI driverlib.lib library to my project.  This corrected the unresolved symbols that came from TI libraries.  I am still having "unresolved symbols" error #10234-D my own symbols that in my own header files.  I will do my best to explain ways in which I reference the directory that has my header files.

    1. In "Linked Resources" - "Path Variable" I defined a variable has the full path definition to the directory where the header files are located.

    2. In "Linked Resources" - "Linked Resources" the resource name of the directory has a corresponding location with full path definition to directory of header files.

    3. In "CCS Build" - "Variables" I have a Variable "name" of type "directory" with "value" of full path definition to directory of header files.

    4. In "ARM Compiler", "Summary of flags set"  one of the include_path values is the full path definition to directory of header files.

    5. In "ARM Compiler", "Include options" I have the "Path Variable" for the directory of header files.

    6. In "ARM Linker", "Summary of flags set", I see the full path definition to directory of header files.

    7. In "ARM Linker", "File Search Path", I used "${workspace_loc:/$ProjName}/Include}" under Add <dir> to library search path

    8. In "C/C++ Build", "Build Variables", I used the "Path Variable" of type "Directory" with value set to full path definition of header files directory.

    Can you tell what I am doing incorrectly?

    Thank you,

    Lettie

  • Hi Lettie,

    I would add the proper paths to your file search path for libraries and headers.  Path variables are for linked resources, build variables for source/headers etc not linked.

    Best Regards,
    Lisa

  • Lettie,

    Lettie Cederquist said:
    I am still having "unresolved symbols" error #10234-D my own symbols that in my own header files.  I will do my best to explain ways in which I reference the directory that has my header files.

    unresolved symbols errors have nothing to do with your header files. The linker is not finding the object file or library that contains these symbols. If these symbols are in a library, make sure they are being linked in. If they come from a source file, make sure that source file is part of your build and the generated object file is being linked in.

    Thanks

    ki

  • Ki,

    Can you please tell me on which screen I should define what libraries & obj files to link in?  I've started over again, this time with a very small main.c file.  The file only has two instructions, but they use the MWARE driverlib.lib.  In linked resources I specified driverlib.lib.  In the Compiler, Include options I give the path to the driverlib.lib file.  And in ARM Linker, File Search Path, I specify the path to driverlib.lib.  Where else do I tell the linker what to link in?

    Thank you,

    Lettie

  • Lettie Cederquist said:
    In the Compiler, Include options I give the path to the driverlib.lib file

    When dealing with linking in libraries and object files, this is happening during the linking stage. So any options you would want to modify would have to impact the linker. Hence, modifying any of the compiler options does not really apply.

    Page 13 of the Compiler User's Guide helps visualize the build flow:

    http://www.ti.com/lit/ug/spru514e/spru514e.pdf

    As you can see, it is the linker options that apply.

    Lettie Cederquist said:
    Can you please tell me on which screen I should define what libraries & obj files to link in?

    As for which screen you should modify, there are multiple ways to add libraries and object files to your build. Libraries are really a collection of object files, meant to be linked into a project. You can add them to your project in multiple ways:

    1) Add the file itself to the project. Whether adding or creating a link to it, it does not matter. If the file appears in the Project Explorer view in the CCS GUI, then it is part of the project and nothing more needs to be done.

    OR

    2) Add it via the linker options (right-click on properties, then Build -> C2000 Linker -> File Search Path, add library to first field)

    OR

    3) Add it via the linker command file. You can add linker options to the linker command file since that file will be passed to the linker. Basically it has the same effect as #2.

    Linker command files are covered in more details in section 7.5 of the Assembly language user's guide:

    http://www.ti.com/lit/ug/spru513e/spru513e.pdf

    Which method you use it completely up to you.

    Now it is less common to take individual obj files generated from another build and link it in. Usually the obj files are generated from compiling and assembling the source files that are already part of the project. For those files, the obj will automatically get linked in. So there is nothing for you to do.

    As for you errors that you say is coming from your code, I don't know why. If those symbols are defined in your source file that is part of the build, then there should not be any issue. I really don't have enough visibility into you project to explain what is going on. If you provide a test case, perhaps I can have a better idea. But the two documents I gave links to, in addition to my comments, should have all the information you need in regards to your linking issue.

    Hope this helps

    ki

  • Ki and Lisa,

    Thank you very much for all the help and suggestions.  I found that I had a problem in my code.  Thanks again for your time and support.

    Lettie

  • Hi Lettie,

    very happy to hear and thanks for updating.

    All the best with development.

    Best Regards,
    Lisa