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.
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:
- 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.
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.