1.clion安装
1.1 clion软件包下载
1.2 clion软件包安装
- (1) windows:直接双击安装,这个没什么好说的
- (2) Linux:
# 1.软件包解压
>> tar -xf [clion安装包]
# 2.解压路径重命名
>> mv [clion解压文件] clion
# 3.获取当前路径
>> cd clion && pwd
/home/mirror/software/clion/bin
# 4.配置环境变量
# ~/.bashrc或~/.zshrc
>> vim ~/.zshrc
export CLION_PATH=/home/mirror/software/clion/bin
export PATH=$PATH:$CLION_PATH
alias clion = clion.sh
1.3 clion破解
2.clion配置
"Editor" -> "Font" -> Font: "Consolas"
# C文件头
"Editor" -> "File and Code Templates" -> "Includes" -> "C File Header"
/*
* @Description:
* @Author: chenjingyu
* @Date: ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE}:${SECOND}
* @FilePath: ${FILE_NAME}
*/
# C头文件
"Editor" -> "File and Code Templates" -> "Files" -> "C Header File"
#parse("C File Header.h")
#pragma once
# C源文件
"Editor" -> "File and Code Templates" -> "Files" -> "C Source File"
#parse("C File Header.h")
#if (${HEADER_FILENAME})
#[[#include]]# "${HEADER_FILENAME}"
#end
# C++类的头文件
"Editor" -> "File and Code Templates" -> "Files" -> "C++ Class Header"
#parse("C File Header.h")
#pragma once
class ${NAME} {
};
# C++类
"Editor" -> "File and Code Templates" -> "Files" -> "C++ Class"
#parse("C File Header.h")
#[[#include]]# "${HEADER_FILENAME}"
"Editor" -> "Live Templates" -> "C/C++" -> "+"
Abbreviation: "name" Description: "namesapace"
Template text:
namespace {
}
"define" -> 勾选"C++" -> "Apply"
Abbreviation: "main" Description: "main"
Template text:
int main(int argc, char *argv[]) {
return 0;
}
"define" -> 勾选"C++" 和"C" -> "Apply"
"Editor" -> "Code Style" -> "C/C++" -> "Tabs and Indents"
Tab size: 2
Indent: 2
Continuation indent: 2
勾选 Keep indents on empty lines
Label indent: 0
Indent in lambdas: 2
Indent members of plain structures: 2
Indent members of classes: 2
Indent visibility keywords in class/structure: 0
Indent members of namespace: 0
Preprocessor directive indent: 0
# 方法一:
"文件" -> "设置" -> "编辑器" -> "文件编码" -> "全局编码"、"项目编码"、"属性文件的默认编码"全部设置为"UTF-8"
# 方法二:
"设置" -> "时间和语言" -> "语言和区域" -> "管理语言设置" -> "更改系统区域设置" -> 勾选"Beta 版:使用Unicode UTF-8提供语言支持(U)" -> "确定" -> "重启电脑"
3.参考资料