Quantcast
Channel: Active questions tagged header - Stack Overflow
Viewing all articles
Browse latest Browse all 797

How to get include directories working for c++ projects on neovim

$
0
0

Suppose i have a project with and src folder to keep all my code, and an include folder to store third-party libraries.

Let's say there is a file include/TestLib/lib.hpp with the following code:

// lib.hpp#include <string>#include <iostream>void Log(std::string text){    std::cout << text << std::endl; }

and the other file is src/main.cpp:

#include "../include/TestLib/lib.hpp"int main(){    Log("Hello world");}

In order for it to not give errors on neovim i have to use the full path of all hpp files. Premake allows me to use include directories to avoid using that and only needing to do as follows:

#include "lib.hpp"int main(){    Log("Hello world");}

When i build it, it compiles correctly, however neovim/clangd is not able to find the include directories. How can i tell clangd where to look for those files?


Viewing all articles
Browse latest Browse all 797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>