Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple-broker not compiling #103

Open
olleyOop opened this issue Aug 22, 2024 · 6 comments
Open

simple-broker not compiling #103

olleyOop opened this issue Aug 22, 2024 · 6 comments

Comments

@olleyOop
Copy link

olleyOop commented Aug 22, 2024

Hello,

after I updated the library in Arduino IDE 2.3.2 I can't compile my project anymore.
Even if I try to compile the example "simple-broker" I get the following error:

In file included from c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyConsole.h:5,
from c:\Users\oreic\Documents\Arduino\libraries\TinyMqtt\src/StringIndexer.h:6,
from c:\Users\oreic\Documents\Arduino\libraries\TinyMqtt\src/TinyMqtt.h:39,
from C:\Users\oreic\AppData\Local\Temp.arduinoIDE-unsaved2024722-3888-hvfh85.6dmcg\simple-broker\simple-broker.ino:1:
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h: In member function 'TinyTerm::CallBackKey TinyTerm::onKey(CallBackKey)':
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h:95:56: error: call of overloaded 'exchange(TinyTerm::CallBackKey&, TinyTerm::CallBackKey&)' is ambiguous
95 | CallBackKey onKey(CallBackKey cb) { return exchange(callback_key, cb); }
| ~~~~~~~~^~~~~~~~~~~~~~~~~~
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h:12:3: note: candidate: 'T exchange(T&, U&&) [with T = std::function<void(TinyTerm::KeyCode)>; U = std::function<void(TinyTerm::KeyCode)>&]'
12 | T exchange(T& obj, U&& new_value)
| ^~~~~~~~
In file included from c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h:6:
c:\users\oreic\appdata\local\arduino15\packages\esp32\tools\esp-x32\2302\xtensa-esp32-elf\include\c++\12.2.0\utility:93:5: note: candidate: 'constexpr _Tp std::exchange(_Tp&, _Up&&) [with _Tp = function<void(TinyTerm::KeyCode)>; _Up = function<void(TinyTerm::KeyCode)>&]'
93 | exchange(_Tp& __obj, _Up&& __new_val)
| ^~~~~~~~
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h: In member function 'TinyTerm::CallBackMouse TinyTerm::onMouse(CallBackMouse)':
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h:96:80: error: call of overloaded 'exchange(TinyTerm::CallBackMouse&, TinyTerm::CallBackMouse&)' is ambiguous
96 | CallBackMouse onMouse(CallBackMouse cb) { mouseTrack(true); return exchange(callback_mouse, cb); }
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~
c:\Users\oreic\Documents\Arduino\libraries\TinyConsole\src/TinyTerm.h:12:3: note: candidate: 'T exchange(T&, U&&) [with T = std::function<void(const TinyTerm::MouseEvent&)>; U = std::function<void(const TinyTerm::MouseEvent&)>&]'
12 | T exchange(T& obj, U&& new_value)
| ^~~~~~~~
c:\users\oreic\appdata\local\arduino15\packages\esp32\tools\esp-x32\2302\xtensa-esp32-elf\include\c++\12.2.0\utility:93:5: note: candidate: 'constexpr _Tp std::exchange(_Tp&, _Up&&) [with _Tp = function<void(const TinyTerm::MouseEvent&)>; _Up = function<void(const TinyTerm::MouseEvent&)>&]'
93 | exchange(_Tp& __obj, _Up&& __new_val)
| ^~~~~~~~
C:\Users\oreic\AppData\Local\Temp.arduinoIDE-unsaved2024722-3888-hvfh85.6dmcg\simple-broker\simple-broker.ino: In function 'void setup()':
C:\Users\oreic\AppData\Local\Temp.arduinoIDE-unsaved2024722-3888-hvfh85.6dmcg\simple-broker\simple-broker.ino:29:41: error: 'red' is not a member of 'TinyConsole'
29 | Console << TinyConsole::red << "****** PLEASE MODIFY ssid/password *************" << endl;
| ^~~
C:\Users\oreic\AppData\Local\Temp.arduinoIDE-unsaved2024722-3888-hvfh85.6dmcg\simple-broker\simple-broker.ino:38:27: error: 'green' is not a member of 'TinyConsole'
38 | Console << TinyConsole::green << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl;
| ^~~~~

exit status 1

Compilation error: 'red' is not a member of 'TinyConsole'

TinyMqtt 0.9.16
TinyConsole 0.4.6

Any help would be appreciated.

@papercodeIN
Copy link

Same error for me as well any solution for this problem ?

@Tschmidt9490
Copy link

go in to the tinyconsole library and switch this

TinyString& TinyString::operator=(TinyString && other)
{
if (this == &other) return *this;
clear();
str = std::exchange(other.str, str);
size_ = std::exchange(other.size_, size_);
free_ = std::exchange(other.free_, free_);
return *this;
}

With this

TinyString& TinyString::operator=(TinyString && other)
{
if (this == &other) return *this;
clear();
std::swap(other.str, str);
std::swap(other.size_, size_);
std::swap(other.free_, free_);
return *this;
}

@papercodeIN
Copy link

go in to the tinyconsole library and switch this

TinyString& TinyString::operator=(TinyString && other) { if (this == &other) return *this; clear(); str = std::exchange(other.str, str); size_ = std::exchange(other.size_, size_); free_ = std::exchange(other.free_, free_); return *this; }

With this

TinyString& TinyString::operator=(TinyString && other) { if (this == &other) return *this; clear(); std::swap(other.str, str); std::swap(other.size_, size_); std::swap(other.free_, free_); return *this; }

Thank You friend, also can you help one more thing ? Could you please tell the file name ? Really sorry for silly question.

@Tschmidt9490
Copy link

Tinystring.cpp

@lutorm
Copy link

lutorm commented Oct 30, 2024

I'm getting the same error, but my Tinystring.cpp already uses std::swap. Besides, the error above says that the call in TinyTerm::onKey is ambiguous. If I change "exchange" to "::exchange" to force the use of the template at the top of the file, the ambiguity is broken. But then I'm getting another error:

/tmp/.arduinoIDE-unsaved2024930-2070929-yr320l.vzzcp/simple-broker/simple-broker.ino: In function 'void setup()':
/tmp/.arduinoIDE-unsaved2024930-2070929-yr320l.vzzcp/simple-broker/simple-broker.ino:29:41: error: 'red' is not a member of 'TinyConsole'
   29 |                 Console << TinyConsole::red << "****** PLEASE MODIFY ssid/password *************" << endl;
      |                                         ^~~
/tmp/.arduinoIDE-unsaved2024930-2070929-yr320l.vzzcp/simple-broker/simple-broker.ino:38:27: error: 'green' is not a member of 'TinyConsole'
   38 |   Console << TinyConsole::green << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl;

and indeed TinyConsole does not have any such members...

There are also numerous other errors, I think this is not kept up to date.

@dkrape
Copy link

dkrape commented Dec 31, 2024

I am getting the same errors. Using Arduino IDE version 2.3.4 and 0.9.16 of the TinyMqtt library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants