How to show colored console output in Clion

后端 未结 2 1945
遥遥无期
遥遥无期 2021-01-18 19:26

I am trying to write a C++ application with Clion that makes use of colored console output using ASCII sequences. When I run the program in Clion, the colors are not shown.

2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-18 20:24

    For me (windows 10) the solution was

    #include 
    

    And then:

    system(("chcp "s + std::to_string(CP_UTF8)).c_str());
    

    Now all the ANSI sequences work!

提交回复
热议问题