我在我的机器中安装了cppcheck
和Sublimelinter
& cppcheck
中的SublimeText3
插件正如文档所述,但我仍然无法让cppcheck
正常工作。我想我在路径变量中做了一些错误。我看了this回答,但无法理解。请帮我配置它。谢谢。
这是我的机器(Ubuntu 16.04)输出到相关命令:
which cppcheck
/usr/bin/cppcheck
我的~/.profile
文件:
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/bin"
这是我的Sublimelinter.sublime-settings文件:
{
"user": {
"debug": false,
"delay": 0.25,
"error_color": "D02000",
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
"gutter_theme_excludes": [],
"lint_mode": "manual",
"linters": {
"cppcheck": {
"@disable": false,
"args": [],
"enable": "style",
"excludes": [],
"std": ["c++11"]
}
},
"mark_style": "outline",
"no_column_highlights_line": false,
"passive_warnings": false,
"paths": {
"linux": [],
"osx": [],
"windows": []
},
"python_paths": {
"linux": [],
"osx": [],
"windows": []
},
"rc_search_limit": 3,
"shell_timeout": 10,
"show_errors_on_save": false,
"show_marks_in_minimap": true,
"syntax_map": {
"html (django)": "html",
"html (rails)": "html",
"html 5": "html",
"javascript (babel)": "javascript",
"magicpython": "python",
"php": "html",
"python django": "python",
"pythonimproved": "python"
},
"warning_color": "DDB700",
"wrap_find": true
}
}
另请注意,每当我尝试添加/ usr / bin / above时,
"paths" : {"linux" : [/usr/bin/]}
Sublime会显示错误。请帮帮我。
答案 0 :(得分:1)
这可能就在您的问题中,但您添加到Sublimelinter.sublime-settings文件的路径应该在引号中。
不正确的:
"paths" : {"linux" : [/usr/bin/]}
校正:
"paths" : {"linux" : ["/usr/bin/"]}
注意:SublimeLinter Troubleshooting Guide的添加路径部分指出,如果您的PATH在正确的空间(Ubuntu的〜/ .profile)中初始化,则您不需要在设置文件中重新添加目录。如果打开SublimeLinter的调试并重新启动SublimeText,您应该在控制台中看到PATH输出