zoukankan      html  css  js  c++  java
  • 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
    }
     
  • 相关阅读:
    [日本语]自动词和他动词区别的重要性
    [日本语]授受关系动词总结
    [日本语]至少すくなく(と)も
    python3: 文件与IO
    python3: 迭代器与生成器(1)
    python3: 数字日期和时间(2)
    python3: 数字日期和时间(1)
    python3: 字符串和文本(4)
    Python Frame
    python3: 字符串和文本(3)
  • 原文地址:https://www.cnblogs.com/brother-louie/p/14018129.html
Copyright © 2011-2022 走看看