Skip to main content
MFran.4
Senior
November 5, 2021
Solved

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

  • November 5, 2021
  • 4 replies
  • 4559 views

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.
Best answer by Richard.Chvr

No update since a while, closing the post.

4 replies

MFran.4
MFran.4Author
Senior
November 24, 2021

Is someone there?

MFran.4
MFran.4Author
Senior
November 29, 2021

Helloooo?

Pavel A.
Super User
November 30, 2021

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
November 30, 2021

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
Technical Moderator
September 27, 2023

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
September 27, 2023

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 VenmoUp vote any posts that you find helpful, it shows what's working..