• vscode 添加头文件目录问题


    开始使用vscode,便被添加头文件路径给挡住了。

    在使用第三方库如boost的时候,应该在tasks.json和c_cpp_properties.json分别添加头文件路径。

    因为vscode的编辑器和编译器分别是两套独立的系统,这跟visual studio是不同的。

    主要原因是没有在tasks.json中指定路径。

    tasks.json

    {
        "version": "2.0.0",
        "tasks": [
            {
                "type": "cppbuild",
                "label": "C/C++: g++ build with mingw-64",
                "command": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe",
                "args": [
                    "-g",
                    "${file}",
                    "--std=c++17",
                    "-ID:\work\00Tools\boost\include\",
                    "-o",
                    "${fileDirname}\simple.exe"
                ],
                "options": {
                    "cwd": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin"
                },
                "problemMatcher": [
                    "$gcc"
                ],
                "group": "build",
                "detail": "compiler: "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe""
            }
        ]
    }

    在c_cpp_properties中添加路径,可以实现单击头文件时可以跳转。

    c_cpp_properties.json

    {
        "configurations": [
            {
                "name": "Win32",
                "includePath": [
                    "${workspaceFolder}/**",
                    "D:\work\00Tools\boost\include\**"                
                ],
                "defines": [
                    "_DEBUG",
                    "UNICODE",
                    "_UNICODE"
                ],
                "compilerPath": "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\g++.exe",
                "cStandard": "c17",
                "cppStandard": "c++17",
                "intelliSenseMode": "gcc-x64"
            }
        ],
        "version": 4
    }
     
  • 相关阅读:
    关于html5的一些知识。
    常见的http状态码总结。
    踩坑记录-安装node-sass运行报错TypeError: this.getResolve is not a function at Object.loader
    踩坑记录-!!vue-style-loader!css-loader错误
    koa-passport做登录注册验证
    nuxt项目里使用vuex状态树
    node(koa、nuxt等项目)中使用import报错问题
    koa+nodemailer实现邮箱验证注册功能
    踩坑记录-nuxt引入vuex报错store/index.js should export a method that returns a Vuex instance.
    常用shell命令积累
  • 原文地址:https://www.cnblogs.com/brother-louie/p/14018129.html
Copyright © 2020-2023  润新知