1、首先需要使用cmake工具配置opencv源码,生成mingw编译器对应的makefile文件
2、使用安装好的mingw-make 命令进行编译,时间较长半个小时(编译若遇到 hypot未定义,改成_hypot即可)
3、编译好之后,会在相应的install目录下包含所需要的头文件include、静态链接库lib、和动态链接库bin文件夹
4、配置vscode主要是对c_cpp_properties.json、task.jsion进行配置,加入头文件路径和静态链接库路径,动态链接库路径bin文件路径加入到环境变量中即可。
task.jsion文件:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "g++",
"args": [
"${file}",
"-o",
"${fileDirname}/${fileBasenameNoExtension}.exe",
"-g", //生成调试信息
"-Wall", //开启额外警告
&