对于brew install eigen的情况来说,
可以使用brew link –overwrite eigen将eigen连接到/usr/local/include/eigen,
此时在cmakelist.txt里加上一行include_directories(/usr/local/include)就可以解决找不到eigen3的问题。
vscode在mac下的智能提示和报错问题,
在.vscode文件夹下创建c_cpp_properties.json
内容为
{
“configurations”: [
{
“name”: “Mac”,
“includePath”: [
“/usr/local/include”,
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1”,
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1”,
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/11.0.3/include”,
“/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include”,
“${workspaceFolder}/**”,
“${default}”
],
“defines”: [],
“macFrameworkPath”: [],
“compilerPath”: “/usr/local/bin/gcc-10”,
“cStandard”: “c11”,
“cppStandard”: “gnu++14”,
“intelliSenseMode”: “clang-x64”
}
],
“version”: 4
}
即可。
不过如果更新gcc/clang/xcode版本,需要修改上述相关配置。