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
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值