<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Clangd on CuSO4_Deposit</title><link>https://depoze.xyz/tags/clangd/</link><description>Recent content in Clangd on CuSO4_Deposit</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Mon, 28 Sep 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://depoze.xyz/tags/clangd/index.xml" rel="self" type="application/rss+xml"/><item><title>Clangd cannot find standard header</title><link>https://depoze.xyz/pages/clangd-standard-header/</link><pubDate>Mon, 15 Jan 2024 00:00:00 +0000</pubDate><guid>https://depoze.xyz/pages/clangd-standard-header/</guid><description>&lt;p&gt;When using clangd (16.0.2) as LSP, it throws the following error:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;[pp_file_not_found] Line 1: &amp;#39;stdlib.h&amp;#39; file not found&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But stdlib.h exists, and gcc compilation passed.&lt;/p&gt;&#10;&lt;h2 id="tldr"&gt;TL;DR&lt;/h2&gt;&#10;&lt;p&gt;Create &lt;a href="https://clangd.llvm.org/installation.html#project-setup"&gt;compilation database file&lt;/a&gt; at root of project, content:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;-isystem&#10;C:\Users\username\scoop\apps\gcc\current\x86_64-w64-mingw32\include&#10;-target&#10;x86_64-pc-windows-gnu&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Where the 2nd line is the path to stdlib.h.&lt;/p&gt;&#10;&lt;h2 id="debug-process"&gt;Debug Process&lt;/h2&gt;&#10;&lt;p&gt;Use &lt;code&gt;--check&lt;/code&gt; to run clangd and get error info:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;% .\clangd.exe --check=\path\to\file.c&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Log:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;I[12:18:46.915] clangd version 16.0.2 (https://github.com/llvm/llvm-project 18ddebe1a1a9bde349441631365f0472e9693520)&#10;...&#10;I[12:18:46.924] Loading compilation database...&#10;I[12:18:46.934] Failed to find compilation database for C:\Users\username\path\to\c_file.c&#10;I[12:18:46.935] Generic fallback command is: &amp;#34;C:\\Users\\username\\scoop\\apps\\gcc\\11.2.0\\bin\\clang&amp;#34; &amp;#34;-resource-dir=C:\\Users\\username\\AppData\\Roaming\\nvim-data\\mason\\packages\\clangd\\clangd_16.0.2\\lib\\clang\\16&amp;#34; -- &amp;#34;C:\\Users\\username\\path\\to\\c_file.c&amp;#34;&#10;...&#10;I[12:18:46.970] Testing features at each token (may be slow in large files)&#10;I[12:18:47.006] All checks completed, 2 errors&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;According to &lt;a href="https://clangd.llvm.org/guides/system-headers#fixing-missing-system-header-issues"&gt;this post&lt;/a&gt;, &amp;ldquo;Generic fallback &amp;hellip;&amp;rdquo; entry means no compilation database. Create an empty &lt;code&gt;compile_flags.txt&lt;/code&gt; besides &lt;code&gt;file.c&lt;/code&gt;, re-run check command, log:&lt;/p&gt;</description></item></channel></rss>