关于VS code的编译链接,以及CMake、CMake Tools的使用
Shortcut keys:
build program ----> ctrl+shift+B
run program -----> F5
for example with command line:
build_link -----> g++ example.cpp -o 1 `pkg-config opencv --cflags --libs opencv`
run script ------> ./1
use cmake
1.write CMakelists.txt,add executable
2.Command line input:
$ mkdir build_xxx
$ cd build_xxx
$ cmake ..
$ make
gcc complier and link:
gcc -pthread -o outfile.out haircut.cpp
Custom Compilation(Reference link:https://blog.csdn.net/u010677365/article/details/80703984)
use cmake tools with VS Code(required cmake minimum version 3.7.0)
ctrl+shift+P ----> input: Tasks:Configure Task -----
---> select first options -----> goto tasks.json
----> configure "args" -----> add library files
Compiling with plug-ins(recommended)
1.install CMake, CMake Tools
2.ctrl+shift+P input :cmake quick start
3.enter the project name and select the type of CMakeList(executable file)
4.F7 or shift+F7 to automatic generate build file and place the build target
under the build folder
5.run the build directory directly as an executable file

浙公网安备 33010602011771号