如何在Clion中显示彩色控制台输出 [英] How to show colored console output in Clion
问题描述
我试图用Clion编写一个C ++应用程序,该应用程序使用通过ASCII序列显示的彩色控制台输出。当我在Clion中运行程序时,颜色不会显示。但是,当我在终端中运行该程序时,便可以看到颜色。
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. But when I run the program in my terminal, then I can see the colors.
是否需要隐藏选项才能使其正常工作?
Is there a hidden option I have to enable for this to work?
编辑:我是说ANSI
I meant ANSI
推荐答案
CLion的控制台不是终端(至少),但是没有什么可以阻止解释与颜色有关的控制代码并相应地突出显示文本。例如,当您触发CMake构建时,就会发生这种情况。
CLion's console is not a terminal (at least yet), but nothings prevents from interpreting the control codes related to color and highlight the text accordingly. This is exactly what happens when you trigger a CMake build, for example.
不幸的是,这并不是为启动应用程序本身而实现的。功能请求在这里: https://youtrack.jetbrains.com/issue/CPP-2471
Unfortunately, this has not been implemented for launching the applications themselves. Feature request is here: https://youtrack.jetbrains.com/issue/CPP-2471
这篇关于如何在Clion中显示彩色控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!