Skip to main content
IVent.1
Senior
Apr 12, 2024 2:09 PM UTC
Solved

C++ compile multiple definition

Hi,

I have a C project, it compiles perfectly.

I changed the extension of main from main.c to main.cpp.

I use the function "Convert to C++", I did "Clean project"

but when I compile the project, I have a bulk of compiling error of this type:

C:/myproject/Debug/../Src/filex.c:62: multiple definition of `Function1'; ./Src/app_filex.o:C:/myproject/Debug/../Src/filex.c:62: first defined here

 

and this for every functions, I suppose.

Any suggestion?thank you

This topic has been closed for replies.
IVent.1
IVent.1Best answer
Senior
Apr 17, 2024 8:59 AM UTC

At the end, I did the project from the beginning, starting directly as a C++ project, adding files by files starting from main, because no way to find the problem in the original project. Thank you.

6 replies

Andrew Neil
Super User
Apr 12, 2024 2:13 PM UTC

So take a look at those errors: they tell you where each of the multiple definitions is - look at those definitions.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
IVent.1
IVent.1Author
Senior
Apr 12, 2024 4:14 PM UTC

I don't have more than one definition.

Andrew Neil
Super User
Apr 12, 2024 4:38 PM UTC

The errors say you do!

Post the full errors, and the source code to which they relate.

In both cases, use this button to post the text:

AndrewNeil_0-1712939865741.png

Copy & paste the errors from the 'Console' window.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.