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.
I have a simple little program that did compile until I re-installed everything due to a computer crash. Now, with the same settings (?) I get linker errors. First, here is my little program:
#include <stdint.h> #include <stdbool.h> #include "driverlib/sysctl.h" #include "IQmath/IQmathLib.h" #define PI 3.14156 uint8_t sine_array[128], i; void main(void) { SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); //40 MHz for (i = 0; i<128; i++) { sine_array[i] = _IQ29sin(_IQ29(2 * PI * i/128 - PI))>>22 & 0xFF; } while(1) { } }
Here is the linker error listing:
**** Build of configuration Debug for project sine_wave_generation ****
"c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building target: sine_wave_generation.out'
'Invoking: ARM Linker'
"c:/ti/ccsv6/tools/compiler/arm_5.1.8/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 --abi=eabi -me -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --display_error_number --diag_warning=225 --diag_wrap=off -z -m"sine_wave_generation.map" --heap_size=0 --stack_size=512 -i"c:/ti/ccsv6/tools/compiler/arm_5.1.8/lib" -i"c:/ti/ccsv6/tools/compiler/arm_5.1.8/include" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="sine_wave_generation_linkInfo.xml" --rom_model -o "sine_wave_generation.out" "./tm4c123gh6pm_startup_ccs.obj" "../tm4c123gh6pm.cmd" -l"C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\ccs\Debug\driverlib.lib" -l"libc.a"
<Linking>
undefined first referenced
symbol in file
--------- ----------------
>> Compilation failure
main c:\ti\ccsv6\tools\compiler\arm_5.1.8\lib\rtsv7M4_T_le_v4SPD16_eabi.lib<args_main.obj>
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "sine_wave_generation.out" not built
gmake: *** [sine_wave_generation.out] Error 1
gmake: Target `all' not remade because of errors.
So to fix this I go to "show build settings/ARM linker/file search path/Include library file or command file as input... where is put the following"
"libc.a"
"C:\ti\TivaWare_C_Series-2.1.0.12573\driverlib\ccs\Debug\driverlib.lib"
then, in the box below (Add <dir> to library search path (--search_path, -i) is put the following:
"${CG_TOOL_ROOT}/lib"
"${CG_TOOL_ROOT}/include"
I am running CCS 6.01 on 64-bit Win7, compiling for the EK-TM4C123GXL launchpad. This all worked before, I guess I just need another suggestion.
Is the function main defined in the object file tm4c123gh6pm_startup_ccs.obj? Because that is the only object file the linker sees on the command line. Is it possible the source file you show is not a file in the project?
Thanks and regards,
-George
I don't see any source or object files in the link step you posted. You need to add your C file to the project so CCS knows to compile it.
Hi George,
How does a function, such a main, come to be defined in tm4c123gh6pm_startup_ccs.obj? I did not modify this file the first time around, and it does not appear to be editable.
Archaeologist:
I created main by right-clicking on the project and selecting "New: file". I then pasted in the source code. Now main appears at the bottom of my project explorer file listing:
When I right-click on the project and select New: source file, then point to where main is in my project directory, I get the message "file already exists". Maybe I started this project wrong by selecting "New: file" and not "New: source file". Should I delete the project and start over - correctly?
You have a file named "main". Right-click and rename it to "main.c". I'm pretty sure that will fix your problem.
Thanks and regards,
-George
Thanks, George, your suggestion worked, but then (as is the nature of these things) another linker error popped up, which I eliminated by including IQmathLib.lib. Now it compiles. Woo-hoo!