This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I've recently updated the toolchain for C2000 from 6.4.4. to 6.4.5.
I noticed, that almost all include files were changed and the compiler now uses a modified STL Port version.
The problem is that if I compile a .cpp file that includes e.g. F2837xD_device.h from device support, then the compiler produces an error like:
"D:/ti/controlSUITE/device_support/F2837xD/v160/F2837xD_headers/include/F2837xD_device.h", line 114: error #20: identifier "_Bool" is undefined "D:/ti/controlSUITE/device_support/F2837xD/v160/F2837xD_headers/include/F2837xD_device.h", line 118: error #20: identifier "_Bool" is undefined
With 6.4.4. we solved the problem by adding the correct namespace identifier like:
// C99 defines boolean type to be _Bool, but this doesn't match the format of // the other standard integer types. bool_t has been defined to fill this gap. typedef _STD _Bool bool_t; //typedef _Bool bool_t; //used for a bool function return status typedef _STD _Bool status_t; //typedef _Bool status_t;
Because we think that _Bool should be defined in namespace std (for C++) and with no namespace for C code. This is not longer working with 6.4.5. because yvals.h is gone (which defined _STD empty for C code in 6.4.4.).
Is there a workaround for _Bool being not defined when a cpp file is compiled that includes any file from the device support folder?
I don't know what is going on. I do suspect some problem in the compiler. I tried to reproduce it, but failed. Please preprocess the problem file and attach it to your next post.
Thanks and regards,
-George
We have determined that a mistake was made when creating the 6.4.5 release. That release should continue using Dinkumware for the C++ RTS. We have removed 6.4.5 from the CCS update site and the standalone download page. In the next few days we will release 6.4.6 with the correct RTS.
With regard to using _STD, you should not rely on this being available in future versions of the compiler. The next compiler releases will be using STLPort for the C++ implementation.
I suspect something else is wrong. _Bool is defined the same way in versions 6.4.4 (prior to the problem with 6.4.5) and 6.4.6. I suggest using the --gen_acp_raw switch to help diagnose the problem. Please read about it in the C2000 compiler manual.
Thanks and regards,
-George
There are three language modes to think about: C89, C99, and C++. C89 does not provide _Bool or bool. C99 provides _Bool, and if you include stdbool.h you also get bool. C++ provides bool but not _Bool.
I'm not sure exactly what version of F2837xD_device.h you are using. Perhaps it looks similar to this?
github.com/.../F2837xS_device.h
That file is clearly designed to work with C89 or C99. It will not work correctly under C++ without some extra definitions. I think this is a flaw in that header file. It does include stdbool.h, but then uses _Bool where it should use bool.
Your workaround should be:
#if defined(__cplusplus) typedef bool _Bool; #endif
The F2837xS_device.h version you posted is v1.70. I'm using v1.91 and have the same problem, so no official fix has been done to this file.