I am trying to use mlpack in VSCode. I have installed the library using brew, and have included the path in c_cpp_properties.json:
{
"configurations": [
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/**",
"/opt/homebrew/Cellar/mlpack/3.4.2_2/include"
],
"defines": [],
"macFrameworkPath": [
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "macos-clang-arm64"
}
],
"version": 4
}
However, when I try and include core.hpp, I get the following error:
cannot open source file "boost/serialization/serialization.hpp" (dependency of "mlpack/core.hpp")C/C++(1696)
Does anyone know how to resolve this? It's my understanding that brew handles the dependencies, is this wrong?
Here is my current tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: clang++ build all files",
"command": "/usr/bin/clang++",
"args": [
"-std=c++17",
"-stdlib=libc++",
"-g",
"${workspaceFolder}/src/*.cpp",
"--include-directory=/opt/homebrew/Cellar/mlpack/3.4.2_2/include",
"--include-directory=/opt/homebrew/Cellar/boost/1.75.0_3/include",
"--include-directory=/opt/homebrew/Cellar/armadillo/10.4.1_1/include",
"-o",
"${workspaceFolder}/build/app",
"-larmadillo",
"-lmlpack"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$gcc"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: /usr/bin/clang++"
}
]
}
Edit: if I add paths for boost and armadillo:
"includePath": [
"${workspaceFolder}/**",
"/opt/homebrew/Cellar/mlpack/3.4.2_2/include",
"/opt/homebrew/Cellar/boost/1.75.0_3/include",
"/opt/homebrew/Cellar/armadillo/10.4.1_1/include"
],
the error becomes:
'mlpack/core.hpp' file not found
In includePath just add this:
"/opt/homebrew/opt/boost/include"