在Visual Studio代码C ++中添加.lib文件

时间:2018-11-04 13:48:55

标签: visual-studio-code

我需要在我的Visual Studio代码中包含jsoncpp。

是否可以在Visual Studio代码中包含.lib文件?

这是我的 c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/*",
                "${workspaceFolder}/C++Script/Dependencies/include"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.16299.0",
            "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "msvc-x64"
        }
    ],
    "version": 4
}

enter image description here

我包括了json.h(尽管我的编译器说找不到头文件),我也想包括.lib文件。

您能告诉我该怎么做吗?我确实知道如何在Visual Studio中执行此操作。 (和喜欢者一起)

1 个答案:

答案 0 :(得分:0)

c_cpp_properties.json用于Intellisense,您需要使用task.json。示例:

{
    "version": "2.0.0",
    "tasks": [
      {
        "type": "shell",
        "label": "cl.exe build active file",
        "command": "cl.exe",
        "args": [
          "/Zi",
          "/EHsc",
          "/Fe:",
          "${fileDirname}\\${fileBasenameNoExtension}.exe",
          "${file}",
          "/I",
          "C:\\vcpkg\\installed\\x86-windows\\include"
        ],
        ...
  }