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.

Unresolved symbols after changing a variable from "int" to "float"

Other Parts Discussed in Thread: CCSTUDIO

Hi. As part of a project I am working on, I have written a function to average values from the ADC. My function is as follows:

float AdcAvg(float *AdcBuf)

{

static int Sum = 0;

static float Average = 0;

int i=0;

for (i=0;i<ADC_BUF_LEN;i++) {

Sum+=*AdcBuf;

}

return Average = Sum/ADC_BUF_LEN;

}

Everything compiles, builds, and runs fine with this. However, I need to change the variable Sum from an int to a float to get rid of roundoff errors. I make the correction as follows: 

static float Sum = 0;

After I made the correction, I tried to rebuild the project. I get the following errors: 

[Linking...] "C:\CCStudio_v3.3MCU\C2000\cgtools\bin\cl2000" -@"Debug.lkf"

<Linking>

warning: entry-point symbol "_c_int00" undefined

 undefined    first referenced                                                                                                     

  symbol          in file                                                                                                          

 ---------    ----------------                                                                                                     

 ___memcpy_ff C:\\..\\Debug\\PieCtrl_5_6_7_8_9_10.obj

error: unresolved symbols remain

error: errors encountered during linking; "./Debug/Lab6.out" not built

I cannot figure out the correlation between changing the type of a variable and introducing unresolved symbols. I have the proper libraries linked (like I said, it compiles, builds, and runs just fine when Sum is declared as "int"). Any ideas?

  • This makes no sense.  Are you certain you did not change any build options?  Is this something you can send in as a test case?

    Thanks and regards,

    -George

  • Yes, I can send it in. I'm new to development with TI products, so please bare with me through some silly questions/mistakes. I'm attaching the .pp files from the two files that seem to be causing the trouble, although when generating the .pp files, I get a different error than before: 

     

    [Linking...] "C:\CCStudio_v3.3MCU\C2000\cgtools\bin\cl2000" -@"Debug.lkf"

    <Linking>

    warning: cannot resolve archive C:/CCStudio_v3.3MCU/C2000/cgtools/lib/libc.a to

       a compatible library, as no input files have been encountered

    fatal error: no input files

    It still generated the two files of interest, but I don't know what that error is from. As far as I know, I'm not using the libc.a library (I'm using rts2800_fpu32_fast_supplement.lib). Here are some details about my project: 

    Code Generation Tool Version: v5.2.1

    Target: tms320f28355

    Build Options

    Compiler:  -g -ppo -pdsw225 -fr"$(Proj_dir)\Debug" -i"..\DSP2833x_headers\include" -d"_DEBUG" -d"LARGE_MODEL" -ml -v28 --float_support=fpu32

    Linker: -c -m".\Debug\Lab6.map" -o".\Debug\Lab6.out" -stack0x200 -s -w -x -priority

     

    I did not change any build options between a successful build and the unsuccessful build. I literally replace "static int Sum = 0" with "static float Sum = 0" and it goes from working to not working. 

    I had to rename the files to a .c extension to get them to upload, and I uploaded them to my profile (wouldn't let me attach it to the thread). Please let me know if I need to do something different with the .pp files that I am uploading. 

    Thanks so much for the help. 

    -Mark

     

     

  • Mark,

    I don't see how changing just the line "static int Sum = 0" with "static float Sum = 0" could generate that linker error. Are you sure you are linking in the runtime library rts2800_fpu32.lib? You mentioned rts2800_fpu32_fast_supplement.lib but the rts2800_fpu32.lib is also required in this case.

    I assume your entry point is set to code_start and not the default _c_int00 (you can check this by going into Build Options, linker tab and see what is set for code entry point (-e option)).  If so, the linker does not automatically include the appropriate runtime, so you need to add it by going into Build Options, Linker tab, Libraries category and adding rts2800_fpu32.lib to the -l option.

    Let us know if this does not resolve the error.

  • Aarti, 

    Linking the rts2800_fpu32.lib fixed the problem! However (and I'm not crazy), I was able to build and run the code with only the fast_supplement.lib library linked if the Sum variable was declared as int! Only when I changed it to float did it generate the errors that were resolved by linking the rts2800_fpu32.lib. I have no idea why it did this, but the problem is solved nonetheless.

    Thank you so much for the help!

    -Mark