How can I support code snipping in CLion

已回答

Hello JetBrains,

I have a problem with CLion. I am making an application that is platform-dependent. I use #ifdef's to exclude code unsupported by each platform. But when I do something like this:

#ifdef _WIN32

cout << "Windows" << endl;

#endif

The cout and whole ifdef content is gray, like it is commented.

 

In C# there was a solution like:

#if UNITY_EDITOR || UNITY_SERVER so I could work with all platforms in the editor, but here I am stuck.

 

Does anybody know what can I do?

0

Hello!

This code is greyed out because it's conditionally uncompiled. 

As a workaround you can try using add_definitions(-D_WIN32) in your CMakeLists.txt.

0

请先登录再写评论。