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.

CCS/MSP430FR5969: Error: Unresolved symbol..., first referenced...

Part Number: MSP430FR5969

Tool/software: Code Composer Studio

Hello,

I have been stuck with these errors and I cannot figure it out. It says it is a C/C++ programming issue, and from what I learnt from other forums, it seems that there is a problem with the link between the files but I do not know how to sovle it. 

undefined first referenced
symbol in file
--------- ----------------
fpadd1271 ./microFourQ-MSP-master/src/crypto_util.obj
fpcopy1271 ./microFourQ-MSP-master/src/crypto_util.obj
fpdiv1271 ./microFourQ-MSP-master/src/crypto_util.obj
fpexp1251 ./microFourQ-MSP-master/src/crypto_util.obj
fpneg1271 ./microFourQ-MSP-master/src/crypto_util.obj
fpsub1271 ./microFourQ-MSP-master/src/crypto_util.obj
mod1271 ./microFourQ-MSP-master/src/crypto_util.obj
remark #10371-D: (ULP 1.1) Detected no uses of low power mode state changing instructions
mp_add128 ./microFourQ-MSP-master/src/eccp2.obj

>> Compilation failure
makefile:177: recipe for target 'FourQ on MSP430 Test.out' failed

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "FourQ on MSP430 Test.out" not built
gmake[1]: *** [FourQ on MSP430 Test.out] Error 1
gmake: *** [all] Error 2
makefile:173: recipe for target 'all' failed

**** Build Finished ****

Thanks,

- Shawn

  • The errors are basically saying that the source file (in this case crypto_util.c) is referencing symbols fpadd1271, fpcopy1271, etc. but the linker cannot find a definition for those symbols. The definition could come from a source file that defines those functions or from a library file. Your first step is to identify which file/library contains definitions for those symbols. Then if it is in a source file, make sure it is added to the project, or if it is in a library file, make sure it is linked into the project. 

  • *help! another issue!*

    Thank you for the swift reply! Your instructions are very clear and I have included an Include guard (#include "fp.h") in the crypto_ultil.c file and it seems to have removed the problems. Here's how I did it:

      

    However, I am now stuck with a new problem and it's telling me that there are redefined symbols in the files.

    Here's a few more screenshots for the context:

    fpmul1271 in fp.h:

    fpmul1271 in eccp.c:

    fpmul1271 in crypto_ultil.c:

    fpmull1271 references:

    I have read through the internet that this problem has something to do with declaration and definition but from what I'm looking at, I'm not sure if that's the case. I also did not include any .c guard in the crypto_ultil.c or eccp2.c files. 

    This is what I understand regarding definitions and declaration:

    • extern unsigned char x;     is a declaration;
    •        unsigned char x;     is a declaration and may also become a definition;
    •        unsigned char x = 0; is a definition.

     

    - Shawn

  • Take a look at this FAQ for guidance on how/where to declare and define variables and functions.

    As mentioned in the FAQ, you may want to consider moving the definition of fpmul1271 to a C source file, and putting an external declaration in the fp.h header file. Then #include the fp.h file in all C files that need it. Note there should only be one definition of the function seen by the compiler tools.

  • Okay, it seems that the .asm file defines the function fpmull1271 and a few more similar asm files does the same for other fp...1271 functions. So I've removed the definitions for the functions in the fp.h file, and it seems to removed the problems. But there are still a lot more redefined symbol problems. Some of which says it's first defined in the crypto_ultil.c file, redefined in the eccp2.c file and so on, yet the function isn't even declared in the crypto_ultil.c file!

    For example,
    symbol "fpinv1271" redefined: first defined in "./microFourQ-MSP-master/src/crypto_util.obj"; redefined in "./microFourQ-MSP-master/src/eccp2.obj" null: symbol "fpinv1271" redefined: first defined in "./microFourQ-MSP-master/src/crypto_util.obj"; redefined in "./microFourQ-MSP-master/src/eccp2.obj"
    Yet, "fpinv1271" is not even found inside the crypto_ultil.c file.

    I'm super confused and there are multiple of these errors and they aren't in the crypto_ultil.c file!
  • Shawn,

    This really comes down to C programming concepts, rather than the tools. The tool (in this case linker) is simply informing you about multiple definitions of the same symbol/routine. Without looking at all the code I can't tell with certainty about this specific error, but did you confirm (per the FAQ linked in my previous post) that the fpinv1271 is not defined in a .h file that is #included in both the above C files? If that is the case, change it so that you declare the function in the header file using "extern" and then define the function in exactly one C source file. 

  • Hi,

    Apologies for the late reply, I was busy.
    I have decided to abandon the project files I was trying to debug. Every issue I solved created even more.
    Nevertheless, thank you very much for your help, it's greatly appreciated.

    Sincerely,
    Shawn