B4R Question (Solved)Problems compiling project - (.text+0x0): multiple definition of `operator new(unsigned int, void*)' error

KimFriis

Member
Licensed User
Longtime User
Hi,
I am having what looks like the exact same problem at this thread: https://www.b4x.com/android/forum/threads/cannot-compile-and-upload-any-project.112648/
BUT the solution tried in that thread have not helped me. So I am looking for if someone can help me try and find what else I can do?
- I have tried to add the
B4X:
#DefineExtra: #define SKIP_B4RNEW
- I have tried to clean the project.
- I have tried to uninstall and reinstall both Arduino IDE and B4R (And delete all directories related to Arduino before reinstall)
- I have made the simplest blink program to try this out.
- I have removed all references to extra libs in B4R and to Libraries in Arduino (have a clean install, without adding anything)
- Making a blink program in Arduino IDE works.
- Making a blink program in B4R, fails during compilation in Arduino IDE, with mentioned error.
- I have also tried to take the SRC into Arduino to see if I can figure out where the problem is and I have found that NEW is defined in 2 places in the code from B4R (B4RCore.cpp and rCore.h) BUT it is also defined in the new.cpp file that is part of the Arduino IDE (hardware/arduino/avr/cores/arduino/) and that is where there the conflict is.

So is there a way where I can make sure that the Arduino IDE sees the new.cpp file before it "sees" the B4RCore.cpp file? (This is what I expect is the problem)

I must admit that my cpp is VERY rusty, as it is more that 25 years since I used it in school.
Hope you can help me.
 

Peter Simpson

Expert
Licensed User
Longtime User
Upvote 0

KimFriis

Member
Licensed User
Longtime User
@Peter Simpson Yes I did and I uninstalled both Arduino and B4R and deleted directories (except my own sourcecode)
@thetahsk It is an Arduino Uno board. (Sorry, forgot that part :) )
And it has all worked before, then I started to play with Wemos D1 Wifi board and got that working, and when I went back to Uno board, it would not let me compile. That is why I tried to uninstall everything and install it again.
 
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
Check in your Arduino IDE under Tools.....Board....Board Manager the version of the Arduino AVR Boards.

1580443946732.png
 
Upvote 0

KimFriis

Member
Licensed User
Longtime User
@thetahsk I have the latest Arduino AVR Boards installed (like you) 1.8.2 so that should be fine right?
I still have a feeling that it is somewhere in the code generation from B4R where something is not correct, but cannot figure out where. And have trouble figuring out what else to do. Maybe clear of the registry also when uninstalling the tools?
 
Upvote 0

KimFriis

Member
Licensed User
Longtime User
Ok, now I just got an idea, and tried to take one of my old B4R projects from 2 months ago, where it all worked, and take that project into Arduino IDE to try and compile that, and that gives the same error. That must mean that it is a problem in my Arduino IDE, or something new that have been introduced in the Arduino IDE right? Because that project worked and could compile 2 month ago, and I have not had it into the B4R IDE.
But it has something to do with this new operator that seems to be defined twice.
 
Upvote 0

KimFriis

Member
Licensed User
Longtime User
Hi @Erel thanks, that was the first thing I tried because you wrote it in the previous post. But it did not work. I have also tried to play with that in the generated C++ code without any luck of getting it to work because it is not in "your" code that it finds the second declaration of new, it is in arduino code (new.cpp)
 
Upvote 0
Top