Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

header files not found: cpp #4381

Closed
yashwardhan-gautam opened this issue Oct 6, 2023 · 7 comments
Closed

header files not found: cpp #4381

yashwardhan-gautam opened this issue Oct 6, 2023 · 7 comments
Labels
bug Something isn't working LSP LSP Related issues

Comments

@yashwardhan-gautam
Copy link

Problem description

Hello,
I'm using pop os, i want to setup lunarvim for competitive programming.
But I think it's not including header files from designated place.
How to update my config (clangd.json or inside config.lua) file to remove these errors?
image

In my system, these header files are located in
/usr/include/x86_64-linux-gnu/c++/11/

LunarVim version

release-1.3

Neovim version (>= 0.9.1)

neovim-0.9-d1c1bace

Operating system/version

Pop!_OS 22.04 LTS

Affected language servers

CPP

Steps to reproduce

No response

Actual behavior

image

Expected behavior

No response

support info

:LspInfo


 Language client log: /home/unlaome/.local/state/lvim/lsp.log
 Detected filetype:   cpp
 
 1 client(s) attached to this buffer: 
 
 Client: clangd (id: 1, bufnr: [1])
 	filetypes:       c, cpp, objc, objcpp, cuda, proto
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             clangd
 
 Configured servers list: clangd

logs

No response

Screenshots

No response

@yashwardhan-gautam yashwardhan-gautam added bug Something isn't working LSP LSP Related issues labels Oct 6, 2023
@quil-hon
Copy link

quil-hon commented Oct 6, 2023

Do you export the CXXFLAGS= correctly in your current terminal session?

@yashwardhan-gautam
Copy link
Author

No, I haven't done that. Can you explain a bit more on that?

@yashwardhan-gautam
Copy link
Author

yashwardhan-gautam commented Oct 7, 2023

➜ echo $CXXFLAGS

➜ echo $CXX

@salimp2009
Copy link

you can have a look at how to configure .clangd file . As far as I can see, this is not a lvim issue. I use C++ and Cmake
https://clangd.llvm.org/config#compileflags
you add this in your .clangd file

CompileFlags:                     
  Add: [-I/usr/include/x86_64-linux-gnu/c++/11/,  --include-directory=/usr/include] 

@Alexis12119
Copy link
Contributor

I just used cmake to generate compile_commands.json which helps the clangd server to recognized header files.

Here's my example repo:

https://github.com/Alexis12119/sfml

Copy link
Contributor

github-actions bot commented Jan 7, 2024

This issue is stale because it has been open for 50 days with no activity.

@github-actions github-actions bot added the stale label Jan 7, 2024
@salimp2009
Copy link

this is not an lvim issue. this is learning C++ issue. you can use CMake as a build system and and add

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

on top your project after project name like this

cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(
  message-package_project
  VERSION 1.2.1
  LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

So this can be closed. This is not lvim related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LSP LSP Related issues
Projects
None yet
Development

No branches or pull requests

5 participants