Clangd: Difference between revisions

From NCOT Wiki
Jump to navigationJump to search
Created page with "== Making Clangd behave == If you have a non-standard compiler with its own include directory, you can set this by creating a file called <code>.clangd</code> and adding this to it: <nowiki> CompileFlags: # Tweak the parse settings Add: - "--include-directory=/home/james/dev/agondev/include" </nowiki> If you have intrinsic types the compiler just magically knows about, and clangd is complaining about them, do the following === Create a fake header === # Make..."
 
 
(One intermediate revision by the same user not shown)
Line 17: Line 17:
# Put the following type of code inside it
# Put the following type of code inside it


  <nowiki>
   
#ifndef FAKE_TYPES_H
#ifndef FAKE_TYPES_H
#define FAKE_TYPES_H
#define FAKE_TYPES_H
 
typedef unsigned int uint24_t;
typedef unsigned int uint24_t;
#endif


#endif
=== Update .clangd ===
</nowiki>


<li value="4">Now add the following to your <code>.clangd</code></li>
Now add the following to your <code>.clangd</code>


  <nowiki>
  <nowiki>
- "-include"
  - "-include"
- ".clangd-includes/fake_types.h"
  - ".clangd-includes/fake_types.h"
</nowiki>
</nowiki>
[[Category:Programming]]

Latest revision as of 18:44, 28 July 2025

Making Clangd behave

If you have a non-standard compiler with its own include directory, you can set this by creating a file called .clangd and adding this to it:

CompileFlags: # Tweak the parse settings
  Add:
    - "--include-directory=/home/james/dev/agondev/include"

If you have intrinsic types the compiler just magically knows about, and clangd is complaining about them, do the following

Create a fake header

  1. Make a folder called .clangd-includes
  2. Make a file inside it called fake_types.h
  3. Put the following type of code inside it


#ifndef FAKE_TYPES_H
#define FAKE_TYPES_H

typedef unsigned int uint24_t;

#endif

Update .clangd

Now add the following to your .clangd

   - "-include"
   - ".clangd-includes/fake_types.h"