sublimelsp / LSP-clangd

C/C++ support for Sublime's LSP plugin provided through clangd.
MIT License
42 stars 1 forks source link

how can i get lsp-clangd to check the code based on c++17? #4

Closed zwyyy456 closed 1 year ago

zwyyy456 commented 1 year ago

My code is as follows:

struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode *left, TreeNode *right)
        : val(x), left(left), right(right) {}
};

However, lsp-clangd shows that nullptr is an undeclared identifier. It seems that lsp-clangd checks the code based on c++98, how to change the standard to c++17?

rwols commented 1 year ago

See https://github.com/sublimelsp/LSP-clangd#usage