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.

How to link .obj files

Other Parts Discussed in Thread: OMAPL138

I have a project that uses functions from a set of .obj files (not a .lib file). What is the correct way to link these to my project?

I have tried pasting the .obj files in the folder where the .obj files get built from my .c fields but that didn't work. Every time I build I get errors to do with "Unresolved symbols." I also tried putting them in the File Search Path of the Linker.

If you need more details let me know. Thanks for any help.

  • Update: Problem still unsolved!

    I looked in the project properties of the summary of flags for the linker and compared it to what is actually run in the build log. All the .obj files that are getting compiled from my .c files are getting tacked on to the end of the linker command after the -o option. 

    I tried using the "Set Additional Flags" button and adding -o "<path to .obj file>" but for some reason CCS does not save your alterations. The update does not appear in the flags summary and when I click the "Set Additional Flags" button again the entry field is blank, indicating nothing had been saved.

    In the "Basic Options" under the Linker options, "Specify output file name (--output_file, -o)" is that only place that has the -o option, however this field only allows putting the .out file name. If I put anything else in the field it interprets it as a .out file name.

    Linker summary:

    -mv6740 -g --gcc --define=omapl138 --define=lcdkOMAPL138 --diag_warning=225 --abi=eabi -z -m"demo_c674x_omapl138_lcdkOMAPL138.map" --warn_sections -i"C:/ti/OMAPL138_StarterWare_1_10_04_01/build/c674x/cgt_ccs/omapl138/lcdkOMAPL138/my_demo/Debug" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/lib" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/include" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/drivers/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/lcdkOMAPL138/platform/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/system_config/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/ipclib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/usblib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/utils/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/grlib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/nandlib/Debug" --reread_libs --xml_link_info="demo_linkInfo.xml" --rom_model

    Build log:

    "C:/ti/ccsv5/tools/compiler/c6000_7.4.4/bin/cl6x" -mv6740 -g --gcc --define=omapl138 --define=lcdkOMAPL138 --diag_warning=225 --abi=eabi -z -m"demo_c674x_omapl138_lcdkOMAPL138.map" --warn_sections -i"C:/ti/OMAPL138_StarterWare_1_10_04_01/build/c674x/cgt_ccs/omapl138/lcdkOMAPL138/my_demo/Debug" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/lib" -i"C:/ti/ccsv5/tools/compiler/c6000_7.4.4/include" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/drivers/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/lcdkOMAPL138/platform/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/system_config/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/ipclib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/omapl138/usblib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/utils/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/grlib/Debug" -i"../../../../../../../binary/c674x/cgt_ccs/nandlib/Debug" --reread_libs --xml_link_info="demo_linkInfo.xml" --rom_model -o "demo.out" "InitEncode.obj" "./usb_mouse_structs.obj" "./usb_dev_mouse.obj" "./lwiplib.obj" "./httpd_io.obj" "./gpio_pinmux_setup.obj" "./demoTouch.obj" "./demoToneLoop.obj" "./demoTimer.obj" "./demoSlides.obj" "./demoRtc.obj" "./demoRaster.obj" "./demoMain.obj" "./demoLedIf.obj" "./demoImages.obj" "./demoI2C.obj" "./demoGpio.obj" "./demoEnet.obj" "./demoAic31.obj" "../demo.cmd" -l"libc.a" -ldrivers.lib -lutils.lib -lplatform.lib -lsystem_config.lib -lgrlib.lib -lusblib.lib

  • Stuart Kent said:

    I have a project that uses functions from a set of .obj files (not a .lib file). What is the correct way to link these to my project?

    You should be able to simply copy those .obj files into the main project folder. Then do a clean rebuild and look for whether those .obj files are getting passed to the linker in the link step.

  • That seemed to get the files included in the linker .exe command but there is another problem now.

    error: --abi=eabi not supported when producing TI-COFF output files

    Is this related or do you know the cause?

  • How do you change the -abi option n the Linker settings? I do not see an option.

  • If you go to Project Properties->Genera, in Advanced Settings, there is a drop-down selection to choose between Legacy COFF or ELF under Output Format.

    More on this in this page: http://processors.wiki.ti.com/index.php/Files_in_CCS_Projects#Executable_file