boost::program_options
1 2 3 4 5
| po::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") ("compression,c", po::value<double>(), "set compression level") ;
|
help,h
之间不能有空格,否则识别不出-h
参数
g++使用include头文件目录时报错
1 2 3
| $ g++.exe -I "C:\Program Files\boost\" hello.cpp g++.exe: fatal error: no input files compilation terminated.
|
需要将\
改为\\
或者/
1
| g++.exe -I "C:/Program Files/boost/" hello.cpp
|
vscode中错误检查
Ctrl+Alt+p:选择c/c++编辑配置
=>包含路径(includePath)
=>换行添加,就可以运行intellisense进行语法检查了。
然后在.vscode/tasks.json
中添加includePath,就能使用F5运行项目
1 2 3 4 5 6 7 8 9 10
| { "tasks": [ { "args": [ "-I", "<yourIncludePath>" ], } ] }
|
vscode的intellisense找不到头文件
将头文件目录放到includePath下面
1 2 3 4 5 6 7 8 9
| { "configurations": [ { "includePath": [ "${workspaceFolder}/src" ], } ] }
|