Multiple Definition error (MCU Xpresso IDE 11.4.1_6260)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multiple Definition error (MCU Xpresso IDE 11.4.1_6260)

1,742 Views
sushmasan
Contributor II

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?

0 Kudos
Reply
12 Replies

1,466 Views
sushmasan
Contributor II

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.

657 Views
Sinai
Contributor I
Had the same issue, adding the flag (-z muldefs) solved the problem.
0 Kudos
Reply

651 Views
sushmasan
Contributor II

@Sinai Oh good to know. Thanks.

0 Kudos
Reply

1,694 Views
ErichStyger
Senior Contributor V

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?

0 Kudos
Reply

1,684 Views
sushmasan
Contributor II

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

0 Kudos
Reply

1,715 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

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

 

0 Kudos
Reply

1,683 Views
sushmasan
Contributor II

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

0 Kudos
Reply

1,676 Views
ErichStyger
Senior Contributor V

are you sure that you only have declarations and no definition there in your header file? Can you check this?

0 Kudos
Reply

1,642 Views
sushmasan
Contributor II

Yes I cross verified and made sure that the variable is only declared and not defined in the header file.

0 Kudos
Reply

1,622 Views
ErichStyger
Senior Contributor V

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?

0 Kudos
Reply

1,546 Views
sushmasan
Contributor II

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.

0 Kudos
Reply

1,532 Views
ErichStyger
Senior Contributor V

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?

0 Kudos
Reply