mac下vscode写eigen代码时有红色波浪线

首先代码中包含eigen的matrix等变量时发现下面有红色波浪线,include路径也配置好了,头文件也能够找到,但是就是有波浪线,这个不是路径问题了。

https://github.com/microsoft/vscode-cpptools/issues/7413

这个链接解决了这个问题,其实是bug导致的,我们只需要按照如下操作

Experienced the same problem on M1 - for future reference a non-invasive way to propate fixes like #7413 (comment) without codebase changes seems to be by using forcedInclude:

1. Create a file such as `.vscode/eigen_fix.h` containing the fix
#if __INTELLISENSE__
#undef __ARM_NEON
#undef __ARM_NEON__
#endif
2. Add it as a `forcedInclude` to the configuration in `.vscode/c_cpp_properties.json`
"forcedInclude": [
    "${workspaceFolder}/.vscode/eigen_fix.h"
],

要注意的是上面这段放的位置,我提供一个我自己的c_cpp***文件供各位参考。

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**",
                "/usr/local/include",
                "/Library/Developer/CommandLineTools/usr/include/**",
                "/usr/local/include/eigen3",
                "/usr/local/include/opencv4"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64",
            "forcedInclude": [
                "${workspaceFolder}/.vscode/eigen_fix.h"
            ]
        }
    ],
    "version": 4
}

剩下的就是愉快的玩耍了,但是每个工程都需要这么弄,嗯。。。很垃圾

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值