Hello Team,
I am seeing multiple definition error when I tried to build the code using 11.4.1_6260, where as the same source code works perfectly fine using 11.3.0_5222 IDE.
I have compared the build configurations between those two versions and everything is similar. I am wondering what is the cause of this build failure.
Can someone please help, if there is a known issue?
Finally the issue is resolved by setting a linker flag to allow multiple definitions (-z muldefs), I believe something might have changed in the recent IDE releases w.r.t linking, older MCUXpresso IDE used to work and build the code successfully. What I noticed was the build is getting PASS without setting the above mentioned linker parameter till this release 11.3.1_5262, it started failing from 11.4.1_6260 onwards.
There could be multiple reasons for this: did you perform a 'clean' on your project already? Best if you do a clean-clean (removing the debug/release output folder(s)).
Next: what is (are) the symbols reported with multiple definitions? Because the IDE change means different standard libraries, maybe you have a symbol defined in your code which now is part of the standard library? Or maybe you are using your custom library with that duplicated symbol in it?
Thanks for your response.
I tried all possibilities (created a new project, did a clean build), but still saw the issue.
Below is one of error snipper for your reference.
c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: ./main_src/FILE1.o:<PATH_To_The_workspace>\<HEADERFILE1.h>:204: multiple definition of `VARIABLE'; ./main_src/FILE2.o:<PATH_To_The_workspace>\<HEADERFILE1.h>:204: first defined here
Hello, my name is Pavel, and I will be supporting your case, could you elaborate further about your issue? I do not get a clue about your issue. could you upload some images?
Best regards,
Pavel
Hello Pavel,
Thanks for your response.
I tried all possibilities (created a new project, did a clean build), but still saw the issue.
Below is one of error snippet for your reference.
c:/nxp/mcuxpressoide_11.4.1_6260/ide/plugins/com.nxp.mcuxpresso.tools.win32_11.4.0.202103011116/tools/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: ./main_src/FILE1.o:<PATH_To_The_workspace>\<HEADERFILE1.h>:204: multiple definition of `VARIABLE'; ./main_src/FILE2.o:<PATH_To_The_workspace>\<HEADERFILE1.h>:204: first defined here
Can you produce a preprocessor listing (e.g. see https://mcuoneclipse.com/2015/11/23/preprocessor-listing-for-gnu-gcc-with-gnu-arm-eclipse-plugins/ ) and check it?
I did check the preprocessor listing, but I didn't see any multiple definitions. As an example, I just compared few files for which I am seeing the issue, but I don't see any multiple definitions.
I believe that's what you suggested me to check.
Yes, this is what I asked to check.
I think without further information, it is really hard for me to know what the problem is.
Can you share a project/source files to reproduce it?
Could you share from the prepropocessor listing all the line occurences of your variable in question?