Skip to main content
IVent.1
Senior
April 12, 2024
Solved

C++ compile multiple definition

  • April 12, 2024
  • 1 reply
  • 3084 views

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

Best answer by IVent.1

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.

1 reply

Andrew Neil
Super User
April 12, 2024

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
April 12, 2024

I don't have more than one definition.

Andrew Neil
Super User
April 12, 2024

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.