KQ7
KQ7

Reputation: 3

vscode how to include leveldb installed on my Mac by HomeBrew

I installed leveldb my mac using homebrew and tried to import it to a cpp project in vscode. However, when trying to import the header file db.h as below:

#include "leveldb/db.h"

The IntelliSense could not find the file. Editing the includePath in c_cpp_properties.json also did not help:

        "includePath": [
            "${workspaceFolder}/**",
            "/usr/local/bin/**",
            "/opt/homebrew/Cellar/**",
        ],

As "brew info leveldb" outputs:

Key-value storage library with ordered mapping https://github.com/google/leveldb/ /opt/homebrew/Cellar/leveldb/1.23 (31 files, 830.7KB) *

So I included /opt/homebrew/Cellar/** but that did not help.

Could anyone point out what the problem is and what potential workarounds there are?

Upvotes: 0

Views: 599

Answers (1)

starball
starball

Reputation: 51937

It's conventional to name the directory that you pass as an include directory "include". If you want to #include "leveldb/db.h", then it you should use /opt/homebrew/Cellar/leveldb/1.23/include instead.

Upvotes: 0

Related Questions