码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • Windows环境VSCode配置OpenCV-项目配置(二)


    1. 修改c_cpp_properties.json

       {
        "configurations": [
          {
            "name": "windows-gcc-x64",
            "includePath": [
              "${workspaceFolder}/**",
              "D:/mingw64/mingw64/include",
              "D:/openCV_win/build/install/include",
              "D:/openCV_win/build/install/include/opencv2"
            ],
            "compilerPath": "D:/mingw64/mingw64/bin/gcc.exe",
            "cStandard": "${default}",
            "cppStandard": "${default}",
            "intelliSenseMode": "windows-gcc-x64",
            "compilerArgs": [
              ""
            ]
          }
        ],
        "version": 4
      }
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
    2. 修改tasks.json

      {
          "tasks": [
              {
                  "type": "cppbuild",
                  "label": "C/C++: g++.exe 生成活动文件",
                  "command": "D:\\mingw64\\mingw64\\bin\\g++.exe",
                  "args": [
                      "-fdiagnostics-color=always",
                      "-g",
                      "${file}",
                      "-o",
                      "${fileDirname}\\${fileBasenameNoExtension}.exe",
                      "-I", "D:/openCV_win/build/install/include/",
                      "-I", "D:/openCV_win/build/install/include/opencv2/",
                      "-L", "D:/openCV_win/build/install/x64/mingw/bin/lib*"
                  ],
                  "options": {
                      "cwd": "${fileDirname}"
                  },
                  "problemMatcher": [
                      "$gcc"
                  ],
                  "group": {
                      "kind": "build",
                      "isDefault": true
                  },
                  "detail": "调试器生成的任务。"
              }
          ],
          "version": "2.0.0"
      }
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
      • 25
      • 26
      • 27
      • 28
      • 29
      • 30
      • 31
    3. launch.json

      {
        "version": "0.2.0",
        "configurations": [
          {
            "name": "C/C++ Runner: Debug Session",
            "type": "cppdbg",
            "request": "launch",
            "args": [],
            "stopAtEntry": false,
            "externalConsole": true,
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}\\${fileBasenameNoExtension}.exe",
            "MIMode": "gdb",
            "miDebuggerPath": "gdb",
            "setupCommands": [
              {
                "description": "Enable pretty-printing for gdb",
                "text": "-enable-pretty-printing",
                "ignoreFailures": true
              }
            ]
          }
        ]
      }
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23
      • 24
    4. 新建test.cpp

       #include 
      #include 
      using namespace std;
      
      int main() {
          std::cout << "Hello, World start" << std::endl;
          cv::Mat img = cv::imread("C:/Users/Pictures/nba/724224.jpg");
          cv::imshow("img", img);
          cv::waitKey(0);
          std::cout << "Hello, World end" << std::endl;
          return 0;
      }
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12

    如果F5出错
    Unexpected GDB output from command “-exec-run”.
    需要修改mingw64的环境变量到git前
    运行效果:
    在这里插入图片描述

  • 相关阅读:
    构建图像金字塔:探索 OpenCV 的尺度变换技术
    Graph Representation Learning学习笔记-chapter3
    CMOS电路基础知识,包括NMOS、PMOS,以及由它们构成的非门、与非、或非等门电路,和版图绘制(L-edit16.3)
    JAVA的学习心路历程之JDK基础入门(上)
    无法访问mybatis.dto.StudengInVO-使用maven编译报错
    OpenJudge NOI 2.1 2723:因子问题
    提高C++性能的编程技巧
    基于微信电子书小程序设计与实现 开题报告
    读取resources 目录资源文件的方法
    [JavaWeb]——JWT令牌技术,如何从获取JWT令牌
  • 原文地址:https://blog.csdn.net/wolf0706/article/details/134449801
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号