VSCODE 配置C++ 与OPENCV

主要是两个json设置

c_cpp_properties.json

复制代码
{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.22621.0",
            "compilerPath": "D:/Libs/mingw810_64/bin/g++.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}

tasks.json

复制代码
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe 生成活动文件",
            "command": "D:/Libs/mingw810_64/bin/g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}","${workspaceFolder}/src/*.cpp",
                "-I",
                "${workspaceFolder}/inc",
                "-static-libgcc",
                "-L",
                "${workspaceFolder}/libs2",
                "-l","libopencv_core440",
                "-l","libopencv_highgui440",
                "-l","libopencv_imgproc440",
                "-l","libopencv_imgcodecs440",
                "-o",
                "${fileDirname}\\build_exe\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "D:/Libs/mingw810_64/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "调试器生成的任务。"
        }
    ],
    "version": "2.0.0"
}

遇到的问题有:

1.定义的h文件与cpp文件不能全部检测到,这一步需要通过task.json里面去进行添加,虽然有的介绍是从includePath中添加,但是,自己尝试并未成功,只能通过task.json添加才能成功。

2.添加dll或者lib文件,需要通过 -L 制定文件夹 -l 制定文件名称来确定。

整个过程类似于CMakeLists.txt ,按照这个过程理解就OK

参考:https://blog.csdn.net/qq_63032911/article/details/130500125

相关推荐
郝学胜-神的一滴1 天前
二叉树后序遍历:从递归到非递归的优雅实现
数据结构·c++·程序人生·算法·
亚马逊云开发者1 天前
GameLift Servers DDoS防护实战:Player Gateway + Ping Beacons延迟优化 + C++ SDK集成
c++·gateway·ddos
念恒123061 天前
继承(下) (Inheritance)
c++
H Journey1 天前
C++之 CMake、CMakeLists.txt、Makefile
开发语言·c++·makefile·cmake
研究点啥好呢1 天前
Github热门项目推荐 | 创建你的像素风格!
c++·python·node.js·github·开源软件
_dindong1 天前
cf1091div2 C.Grid Covering(数论)
c++·算法
沫璃染墨1 天前
C++ string 从入门到精通:构造、迭代器、容量接口全解析
c语言·开发语言·c++
6Hzlia1 天前
【Hot 100 刷题计划】 LeetCode 17. 电话号码的字母组合 | C++ 回溯算法经典模板
c++·算法·leetcode
计算机安禾1 天前
【数据结构与算法】第36篇:排序大总结:稳定性、时间复杂度与适用场景
c语言·数据结构·c++·算法·链表·线性回归·visual studio
unicrom_深圳市由你创科技1 天前
做虚拟示波器这种实时波形显示的上位机,用什么语言?
c++·python·c#