1. Black Friday Sale - 50% off

    B4A Standard for $29 instead of $59!
    Buy Now
    Dismiss Notice

B4R Question Error/Bug in rCore.h when using the arduino "new" library?

Discussion in 'B4R Questions' started by TiDi, Mar 6, 2018.

  1. TiDi

    TiDi Member Licensed User


    Few months ago I start using B4A and B4R.
    Then I try this nice tutorial:

    After some study (the android interface was missing) I was able to run it on the LOLIN32. I included also some improvement, like feed back and retry (Erel example).
    That was with Arduino IDE 1.8.1, but I do not know which rCore.h library version was linked nor if the NEW library was involved.

    A couple of days ago I update the Arduino IDE to the 1.8.5 and I tested with some example.
    Then I switch to B4R, but a check of the relay tutorial give me a strange error on the NEW function (Arduino).
    Search on Internet do not provide any solution.
    To keep the long story short, before to go back to IDE 1.8.1, I found "a" solution by comment this code on the rCore.h (version 2).

    #if !defined(_NEW)
    extern void *operator new( size_t size, void *ptr );

    It is a real Bug or the problem is on the NEW library?

    Error reported

    c:\users\. .\documents\arduino\hardware\espressif\esp32\tools\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\new: In function 'void* operator new(std::size_t, void*)':
    c:\users\. .\documents\arduino\hardware\espressif\esp32\tools\xtensa-esp32-elf\xtensa-esp32-elf\include\c++\5.2.0\new:129:51: error: declaration of 'void* operator new(std::size_t, void*) noexcept' has a different exception specifier
    inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
    In file included from C:\Users\..\DOCUME~1\B4R\8_relay\Objects\bin\sketch\B4RDefines.h:24:0,
    from C:\Users\. .\DOCUME~1\B4R\8_relay\Objects\bin\sketch\AsyncStreams.cpp:1:
    rCore.h:19: error: from previous declaration 'void* operator new(size_t, void*)'
    extern void *operator new( size_t size, void *ptr );

  2. Erel

    Erel Administrator Staff Member Licensed User

    I've downloaded v1.8.5 and tested it with both a standard Arduino and ESP8266 and it worked properly.

    Tested with B4R v2.20.
  3. TiDi

    TiDi Member Licensed User

    Hi thanks

    Unfortunately I have only LOLIN32 (ESP32) and I cannot test the ESP8266.
    I find this old lib that is for the ESP8266 and I tray to use it.


    It works, but only with the modified rCore.
    I upload the Arduino code and also the Andoid one, even if this is non involved in the problem, just in case some one is interested to investigate the problem.
    In the Arduino archive I put also the compiler report (working version) and the "new" library. Compilation involve many many files.


    Attached Files:

  4. Erel

    Erel Administrator Staff Member Licensed User

    Do you get any error if you try to compile a new, empty project?
  5. TiDi

    TiDi Member Licensed User

    Empty project never generate error, with or without modification.
    But another "old" project generate the same error without the modification. Even this was ok before IDE update.
    Both use the WiFi, while another (project), with only analog I/O involved, work and no error like the empy project.
    See Sample.zip.

    Attached Files:

  6. Erel

    Erel Administrator Staff Member Licensed User

    I've tried the B4R.Server project. It compiles fine here.

    Can you post the error message you see when you compile that project?
  7. TiDi

    TiDi Member Licensed User

    Here the reports with the error, relay and server project.
    Of the relay I put also the Arduino IDE report (loading the B4R project).

    Attached Files:

  8. Erel

    Erel Administrator Staff Member Licensed User

    Does it work if you comment line 18 in rCore.h ? (comment it with //)
  9. TiDi

    TiDi Member Licensed User

    Yes they compile without error and work.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice