#mkdir -p a/b/c 一次性创建多层不存在的目录
#mkdir a b c 当前目录创建3个文件夹
#tree
#touch linux.txt
# -r 递归
#man 使用方法 man ls
#vim
:set nu 显示行号
#g++ -E test.cpp -o test.i 预编译
#g++ -S test.i -o test.s 编译
#g++ -c test.s -o test.o 汇编
#g++ test.o -o test 链接
# g++ -O[n] 优化源代码
# g++ -Wall 打印警告信息
# g++ -w 关闭警告信息
# g++ -DDEBUG
#生成静态库
g++ func.cpp -c -I../include
ar rs libfunc.a func.o
#生成动态库
g++ func.cpp -I../include -fPIC -shared -o libfunc.so
g++ main.cpp -Iinclude -lfunc -Lsrc -o dyna_main
#运行可执行文件
LD_LIBRARY_PATH=src ./dyna_main
#gdb
file a.out gdb a.out
quit
break 13
b 14
info breakpoints
i b
print p 打印变量
continue
display
回车键 继续执行上一条命令
list 显示断点附件的代码
#VSCODE
F2 变量同意重命名
ctrl+G 光标跳转行数
ctrl shift +
#CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(SOLIDERFIRE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_BUILD_TYPE Debug)
include_directories(${CMAKE_SOURCE_DIR}/include)
set(SRC
src/Gun.cpp
src/Solider.cpp
main.cpp)
add_executable(my_cmake_exe $SRC)
#task.json
{
"version": "2.0.0",
"options": {
"cwd": "${workspaceFolder}/build"
},
"tasks": [
{
"type": "shell",
"label": "cmake",
"command": "cmake",
"args": [
".."
]
},
{
"label": "make",
"group": {
"kind": "build",
"isDefault": true
},
"command": "make",
"args": [
]
},
{
"label": "Build",
"dependsOrder": "sequence", // 按列出的顺序执行任务依赖项
"dependsOn":[
"cmake",
"make"
]
}
]
}