1. Linux 下编译c++
vim test.cpp // 创建文件
g++ test.cpp // 编译文件
./a.out // 执行文件
g++ test.cpp -o new_file.out 编译C++文件,生成new_file.out文件 ( -o 字母 o)
2 . 设置 vim
vi ~/.vimrc
Esc -> shift + q -> wq
vim test.cpp // 创建文件
g++ test.cpp // 编译文件
./a.out // 执行文件
g++ test.cpp -o new_file.out 编译C++文件,生成new_file.out文件 ( -o 字母 o)
2 . 设置 vim
vi ~/.vimrc
set nobackup
set nu
syntax on
set showcmd
set showmatch
set ignorecase
set smartcase
set incsearch
set autowrite
set hidden
set tabstop=8
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
set cindent
Esc -> shift + q -> wq
设置完后保存退出。
执行 source ~/.vimrc 使配置生效
编译:
g++ test.cpp
g++ -o test test.cpp