How to properly set environment variable TERM in CLion

烂漫一生 提交于 2019-12-10 11:55:10

问题


Using CLion on OSX, I'm creating a simple console app in which I want to do a system("clear"). When I'm running the app in the OSX terminal, it works without issue. When I run it using the CLion terminal, the system("clear") fails with message :

TERM environment variable not set.

I first tried to manually set it in my cmakelists.txt file without success by doing

set(ENV{TERM} "xterm-256color")

I then tried to manually set it (followed by full restart) in CLion settings for both Console and CMake sections in Build, Execution, Deployment using the following key/value pair (Environment option):

 TERM      xterm-256color

In my OSX terminal, doing a env | grep TERM prints out

TERM_PROGRAM_VERSION=388

TERM_PROGRAM=Apple_Terminal

TERM=xterm-256color

What am I missing? I unfortunately can't find it...


回答1:


Finally found the fix. You must add the Environment Variable TERM=xterm-256color not in the Console or the CMake config bug in the your Run/Debug configuration.



来源:https://stackoverflow.com/questions/42263743/how-to-properly-set-environment-variable-term-in-clion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!