【问题标题】:Problem with VSCODE includes using intels IPP libaraysVSCODE 的问题包括使用英特尔 IPP 库
【发布时间】:2020-11-05 12:54:26
【问题描述】:

嗨,我不明白为什么我不能使用 Visual Studio 代码从英特尔 IPP libaray 构建简单示例,它一直说致命错误:ipp.h:没有这样的文件或目录 2 | #包括“ipp.h”。我不明白为什么 VSCODE intellisense 可以看到所有 ipp 包含的内容。 我使用的是 Ubuntu 20.04 gcc/g++ 9 和 Visual Studio 代码 1.50.1。 如果我使用,我可以很好地编译和运行示例

g++ -g ipptest.cpp -I $IPPROOT/include -L$IPPROOT/lib/intel64 -o ipptest -lippi -lipps -lippcore

然后运行

./ipptest

从命令行 我的 task.json 文件看起来像这样

{
"version": "2.0.0",
"tasks": [
    {
        "type": "cppbuild",
        "label": "C/C++: g++ build active file",
        "command": "/usr/bin/g++",
        "args": [
            "-g",
            "${file}",
            "-I ${IPPROOT}/include",
            "-L ${IPPROOT}/lib/intel64",
            "-o",
            "${fileDirname}/${fileBasenameNoExtension}",
            "-lippi -lipps -lippcore"
        ],
        "options": {
            "cwd": "/usr/bin"
        },
        "problemMatcher": [
            "$gcc"
        ],
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "detail": "compiler: /usr/bin/g++"
    }
]

}

和 c_cpp_properties.json

{
"configurations": [
    {
        "name": "Linux",
        "includePath": [
            "${IPPROOT}/**",
            "${workspaceFolder}/**"
        ],
        "defines": [],
        "compilerPath": "/usr/bin/gcc",
        "cStandard": "gnu17",
        "cppStandard": "gnu++14",
        "intelliSenseMode": "gcc-x64"
    }
],
"version": 4

}

【问题讨论】:

    标签: gcc visual-studio-code g++ vscode-tasks intel-ipp


    【解决方案1】:

    好的,发现问题 Visual Studio 代码不太聪明地告诉你出了什么问题,最终我找到了问题。

    问题出在 task.json 文件中

    task.json 文件的固定版本

    {
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++ build active file",
            "command": "/usr/bin/g++",
            "args": [
                "-g",
                "${file}",
                "-I${IPPROOT}/include",
                "-L${LD_LIBRARY_PATH}",
                "-lippcore",
                "-lipps",
                "-lippi",
                "-o",
                "${fileDirname}/${fileBasenameNoExtension}"
            ],
            "options": {
                "cwd": "/usr/bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: /usr/bin/g++"
        }
    ]
    

    }

    问题 -I ${IPPROOT}/include 错误 -I${IPPROOT}/包括正确 -I 和 $ 之间不能有空格 每个库文件也必须添加到新行,例如:不能这样写“-lipps -lippi -lippcore” 必须这样写 “-嘴唇”, “-里皮”, “-lippcore”

    希望对遇到同样问题的人有所帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-04
      相关资源
      最近更新 更多