Defining preprocessor symbols for CLion analyzer

我的未来我决定 提交于 2019-12-04 23:53:37

Clion now has a macro which you can use to detect the IDE: https://youtrack.jetbrains.com/issue/CPP-1296#comment=27-1846360

#ifdef __JETBRAINS_IDE__
    // Stuff that only clion will see goes here
#endif

This allows you to put in defines to make clion render your code properly in cases where it can't be clever enough to figure it out.

The __JETBRAINS_IDE__ macro's value is a version string for the IDE. Specific versions of the macro exist for different Jetbrains IDEs: __CLION_IDE__, __STUDIO_IDE__ (for Android Studio), and __APPCODE_IDE__ (for AppCode).

Yay!

Note: At time of writing, this is only available in the latest CLion EAP.

To get syntax highlighting: Go to Settings ⇒ Editor ⇒ Colors&Fonts ⇒ C/C++ and remove all ticks for 'Conditionally non-compiled code'. This way all code will show up with the usual highlighting.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!