openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

msys2 error in ofLog

Open dimitre opened this issue 5 months ago • 3 comments

I'm porting all that is needed to run OF with ofLibs in msys2, and when I updated compiler from -std=gnu++17 to -std=gnu++20 (because of std::clamp and std::lerp) now there is a fatal error in ofLog.h

error: use of deleted function. it seems << operator is overriding string or char

		template <typename T>
		ofLog & operator<<(T value) {
			message << value << getPadding();
			return *this;
		}

Any ideas of how to solve this one?

dimitre avatar Aug 15 '25 04:08 dimitre

I'll let @artificiel chime in here, but it seems to be related to a stricter rule with C++ for types that have deleted operators for ostream.

ofTheo avatar Aug 15 '25 15:08 ofTheo

Might need an explicit u8 or char overload.

Definitely utf8 issue Try something along these lines:

ofLog& operator<<(char8_t value) { message << static_cast(value) << getPadding(); return *this; }

ofLog& operator<<(const std::u8string& value) { message << std::string_view(reinterpret_cast<const char*>(value.data()), value.size()) << getPadding(); return *this; }

On Sat, 16 Aug 2025 at 1:47 am, Theodore Watson @.***> wrote:

ofTheo left a comment (openframeworks/openFrameworks#8464) https://github.com/openframeworks/openFrameworks/issues/8464#issuecomment-3191942645

I'll let @artificiel https://github.com/artificiel chime in here, but it seems to be related to a stricter rule with C++ for types that have deleted operators for ostream.

— Reply to this email directly, view it on GitHub https://github.com/openframeworks/openFrameworks/issues/8464#issuecomment-3191942645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGK2HESVMY54PJC6R4F3I33NX6HTAVCNFSM6AAAAACD6TLJH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCOJRHE2DENRUGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

danoli3 avatar Aug 16 '25 01:08 danoli3

taking a better look at the logs, it seems to be related to ofSerial.cpp trying to log a WCHAR array in ofSerial.cpp line 452. I don't think echoing a serial buffer to console means a lot so it probably can be removed.


../../../libs/openFrameworks/utils/ofLog.h:515:33: error: use of deleted function 'std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const wchar_t*) [with _Traits = char_traits<char>]'
  515 |                         message << value << getPadding();
      |                         ~~~~~~~~^~~~~~~~

dimitre avatar Aug 19 '25 20:08 dimitre