Author Topic: __cplusplus always defined for C project.  (Read 3157 times)

Barak

  • Community Member
  • Posts: 13
  • Hero Points: 1
__cplusplus always defined for C project.
« on: January 17, 2017, 12:17:13 AM »
I created a workspace for an IAR project that uses C, but in Slickedit the __cplusplus is always defined so I cannot find member variables to structures etc as it is always requiring me to do namespace::structure::member, which of course C doesn't understand. It makes using Slickedit a pain as it can't auto complete anything for me. A lot of the header files have:
#ifdef __cplusplus
# include <cstdint>
#endif
or
#if defined( __cplusplus ) &&  defined( USE_NAMESPACE )
 namespace space {
#endif
In both instances above the #include/namespace are shown in the enabled colour, and in the latter example the USE_NAMESPACE isn't defined anywhere in the source yet Slickedit seems think that it is.
Any ideas what is wrong with my setup? How do I force Slickedit to treat the whole project as only C, not C++? Is it to do with how I created the project/workspace? I used the Other C/C++. I can't find anything related to just a C workspace.
Cheers,
Barak.

Dennis

  • Senior Community Member
  • Posts: 3992
  • Hero Points: 520
Re: __cplusplus always defined for C project.
« Reply #1 on: January 17, 2017, 03:48:54 PM »
I would undefine __cplusplus in the workspaces that are straight C.

Project > Workspace Properties > C/C++ Preprocessing...

Click "New...", enter __cplusplus, hit OK.

Then with __cplusplus selected click on
  • undef to mark it as undefined.


Barak

  • Community Member
  • Posts: 13
  • Hero Points: 1
Re: __cplusplus always defined for C project.
« Reply #2 on: January 23, 2017, 01:23:51 AM »
Thank you! I had no idea that you could do that per workspace.