#Clion如何输出ANSI转义
首先源于,引入dbg-macro后,运行发现控制台全部是
C:\Users\WuXiangGuJun\CodeSpace\ClionCodeProjects\Tina\cmake-build-debug\tests\tests.exe
?[02m[..a\tests\src\main.cpp:16 (main)] ?[0m?[36mmessage?[0m = ?[01m"hello"?[0m (?[32mstd::string?[0m)
?[02m[..a\tests\src\main.cpp:19 (main)] ?[0m?[36m3 * a?[0m = ?[01m6?[0m (?[32mint32_t?[0m)
?[02m[..a\tests\src\main.cpp:22 (main)] ?[0m?[36mnumbers?[0m = ?[01m{7, 13, 42}?[0m (?[32mstd::vector<int32_t>?[0m)
?[02m[..a\tests\src\main.cpp:24 (main)] ?[0m?[01mthis line is executed?[0m
?[02m[..a\tests\src\main.cpp:7 (factorial)] ?[0m?[36mn <= 1?[0m = ?[01mfalse?[0m (?[32mbool?[0m)
?[02m[..a\tests\src\main.cpp:7 (factorial)] ?[0m?[36mn <= 1?[0m = ?[01mfalse?[0m (?[32mbool?[0m)
?[02m[..a\tests\src\main.cpp:7 (factorial)] ?[0m?[36mn <= 1?[0m = ?[01mfalse?[0m (?[32mbool?[0m)
?[02m[..a\tests\src\main.cpp:7 (factorial)] ?[0m?[36mn <= 1?[0m = ?[01mtrue?[0m (?[32mbool?[0m)
?[02m[..a\tests\src\main.cpp:8 (factorial)] ?[0m?[36m1?[0m = ?[01m1?[0m (?[32mint32_t?[0m)
?[02m[..a\tests\src\main.cpp:10 (factorial)] ?[0m?[36mn * factorial(n - 1)?[0m = ?[01m2?[0m (?[32mint32_t?[0m)
?[02m[..a\tests\src\main.cpp:10 (factorial)] ?[0m?[36mn * factorial(n - 1)?[0m = ?[01m6?[0m (?[32mint32_t?[0m)
?[02m[..a\tests\src\main.cpp:10 (factorial)] ?[0m?[36mn * factorial(n - 1)?[0m = ?[01m24?[0m (?[32mint32_t?[0m)
进程已结束,退出代码为 0
这些字符,没有颜色。于是经过修改终端为PowerShell等其他方式发现还是不行,才发现只需要勾选在输出控制台模拟终端既可。