New project use old objects

Please,
If I create a new sketch which uses files from an older
I get "multiple definition" Errors because objects from a sketch before are included when linking.
I tried to delete them in TEMP folder, but this objects are restored again.

How to start with a clean sketch?

Thank you for advice
Erhy with Arduino IDE 2.0 rc9.1

Hi @erhy. Thanks for your report.

Please provide me with instructions I can follow to reproduce the bug.

Here my turn with Arduino 1.8.19. It results also with IDE 2.0 rc9.1

File New
save as
SubCamRobotV04
compiled error free

content changed with code from previous example
compiled with errors, because missed include file

new Tab parsebytes.h for missed include file
content changed with code from previous example

new Tab myconfig.h for missed include file
content changed with code from previous example

purged CameraWebServer in H:\Users\gle\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\libraries\ESP32\examples\Camera

compiled again with error because undefined references

but there are objects listed from older project here:
C:\Users\gle\AppData\Local\Temp\arduino_build_107559\libraries\esp32-cam-webserver-master

and I got the failure:
C:\Users\gle\AppData\Local\Temp\arduino_build_723552\libraries\esp32-cam-webserver-master\app_httpd.cpp.o: in function startCameraServer(int, int)': H:\Users\gle\Documents\Arduino\libraries\esp32-cam-webserver-master/app_httpd.cpp:746: **multiple definition** of startCameraServer(int, int)';
C:\Users\gle\AppData\Local\Temp\arduino_build_723552\sketch\app_httpdV0.cpp.o:H:\Users\gle\Documents\Arduino\SubCamRobotV04/app_httpdV0.cpp:992: first defined here

the folder arduino_build_723552 disappears if I quit the Arduino IDE

when I restart the IDE I got the same errors

Please help me to continue my developments

Unfortunately it is still not clear to me.

Let's try this:

  1. Open the problematic sketch in the Arduino IDE.
  2. Select Sketch > Show Sketch Folder from the Arduino IDE menus.
  3. Put the entire sketch folder in a ZIP file.
  4. Open a forum reply here by clicking the Reply button.
  5. Click the "Upload" icon (image) on the post composer toolbar:
    image
  6. Select the .zip file you created.
  7. Click the Open button.
  8. Click the Reply button to publish the post.

Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the ZIP file onto the post composer field to attach it.

Thank you for the discussion.
This is the sketch folder:
SubCamRobotV04.zip (44,5 KB)

Perhaps this helps to find the reason:

Again I opened this sketch with IDE 2.0 rc9.1
and compile brings this failure:

grpc: error while marshaling: proto: Marshal called with nil
Compilation error: grpc: error while marshaling: proto: Marshal called with nil

This is currently Arduino IDE 2.x's very cryptic way of telling you that you forgot to select a board from either the Tools > Board menu or the dropdown board selector menu on the toolbar.

The bug is being tracked by the developers here:

If you have a GitHub account, you can subscribe to that issue to get notifications of any new developments related to this subject.

There is also an issue tracking the fact that even the less cryptic intended error message from before the introduction of the arduino/arduino-cli#1812 bug is still not very clear:

It seems clear that this has nothing to do with the Arduino IDE or zombie objects from a temporary build folder. It is simply the code in your sketch.

You have one definition of startCameraServer(int, int) in the app_httpdV0.cpp file in your sketch folder (line 992).

There is another definition of startCameraServer(int, int) in the "esp32-cam-webserver" library at this path:

H:\Users\gle\Documents\Arduino\libraries\esp32-cam-webserver-master/app_httpd.cpp

The Arduino build system compiles all the .cpp files that are contained in the sketch source folder.

The Arduino IDE build system compiles all the .cpp files that are contained in the libraries discovered via the #include directives in your sketch, and in those libraries, and so on...

If there is a definition of a function in a source file of a sketch, and another definition of a function of the same signature in a source file of a library compiled by the build system, you get this multiple definition error message.

I don't know why you added this app_httpdV0.cpp file to your sketch. so I can't provide specific instructions for fixing the error, but I can list some potential approaches:

  • If app_httpdV0.cpp has not purpose, simply delete it from the sketch folder.
  • If the compilation of the "esp32-cam-webserver" library was unintended, investigate why it was discovered. Enabling verbose output during compilation in File > Preferences and then studying the text in the Output panel of the IDE after compiling the sketch will help with this
  • If both functions are wanted, adjust the code to prevent the name collision
1 Like

Thank you so much!
My failure was to import the library esp32-cam-webserver-master with .zip from GitHub
and duplicated the code in the sketch
I fixed it by purging the folder CameraWebServer in the directory libraries, a sub folder of the standard Arduino directory.

You are welcome. I'm glad if I was able to be of assistance.

Regards, Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.