Skip to main content
MFran.4
Senior
Nov 5, 2021 7:35 AM UTC
Solved

Booleans not showing up if C++ "bool" is used

Hello again, I know i posted some time ago but my question is not seen anymore (link to original https://community.st.com/s/question/0D53W00000wWDX2SAO/cubemonitor-still-not-seeing-boolean-values)

I was suggested to to include "stdbool.h" but, as I'm working with a C++ project, G++ says that bool is supported and what I get in "stdbool.h" is the following (italic is greyed out code):

#ifndef __cplusplus

#define bool   _Bool

#define true   1

#define false   0

#else /* __cplusplus */

/* Supporting _Bool in C++ is a GCC extension. */

#define _Bool   bool

#if __cplusplus < 201103L

/* Defining these macros in C++98 is a GCC extension. */

#define bool   bool

#define false   false

#define true   true

#endif

#endif /* __cplusplus */

I could manually modify the file to use "C" bool but, is there another way?

Thank you!

This topic has been closed for replies.
Richard.Chvr
Richard.ChvrBest answer
ST Technical Moderator
Sep 27, 2023 1:58 PM UTC

No update since a while, closing the post.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

6 replies

MFran.4
MFran.4Author
Senior
Nov 24, 2021 3:04 PM UTC

Is someone there?

MFran.4
MFran.4Author
Senior
Nov 29, 2021 3:22 PM UTC

Helloooo?

Pavel A.
Nov 30, 2021 1:02 AM UTC

So, is your source file C or C++? If C++ then just do not include stdbool.h, as you already have bool ?

MFran.4
MFran.4Author
Senior
Nov 30, 2021 7:31 AM UTC

Mainly c++ files.

As i wrote, if i include stdbool it won't use stdbool's bool, but c++ bool!

These lines are greyed out:

#ifndef __cplusplus

#define bool   _Bool

#define true   1

#define false   0

And i think cubeMonitor wants that type of bool above, not what i have as active code in the file.

/* Supporting _Bool in C++ is a GCC extension. */

#define _Bool   bool

Richard.Chvr
Richard.ChvrBest answer
ST Technical Moderator
Sep 27, 2023 1:58 PM UTC

No update since a while, closing the post.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Tesla DeLorean
Guru
Sep 27, 2023 2:44 PM UTC

Please stop churning up years old stale content and awarding yourself the best answer.

Just close the threads quitely/transparently so they don't bubble up as new content/posts.

 

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..