简体   繁体   中英

Visual Studio C++ code how to autoindent preprocessor directives

How to use autoindent the preprocessor directives

For example in Visual studio all preprocessor directives intended like this

void test(){
#if _SOME_VAR
    std::cout << "test" << std::endl;
#if _SOME_VAR2
      std::cout << "test2" << std::endl;
#endif
#endif
}

How can i make code auto indents like this

void test(){
  #if _SOME_VAR
    std::cout << "test" << std::endl;
    #if _SOME_VAR2
      std::cout << "test2" << std::endl;
    #endif
  #endif
}

The solution is

Tools->Options->Text Editor->Indentation->Position of preprocessor directives

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM