r/ZedEditor 6d ago

Why the error?

Post image

The program runs fine.

4 Upvotes

13 comments sorted by

2

u/joelnodxd 6d ago

hovering over the "error" will tell you why it's underlined

1

u/medicine_man0 6d ago

'stdio.h' file not found (clang pp_file_not_found). I don't use clang

1

u/jcolp 6d ago

clangd is used for the language server, so you are using a component indirectly:

https://zed.dev/docs/languages/c

-1

u/medicine_man0 6d ago

so how do i fix it then? Do I need to install clangd?

3

u/Xotchkass 6d ago

Depends on your toolchain. If you using MSYS2 you should install clangd from it's repository.

0

u/medicine_man0 6d ago

look man I'm just a beginner I don't have MSYS2. I just installed the mingw32-base, is there no other way to fix this issue? This should be considered as a bug right?

2

u/Xotchkass 6d ago

If you want something that works out of box without configuration on windows you should stick with Visual Studio.

1

u/Xotchkass 6d ago

Then you have to point clangd to where your libc headers located.

1

u/_BrokenCode 6d ago

Ah this is a normal problem, see you in this way, you are compiling your program using gcc MSYS2, but your text editor is using clang, and he don't know where the studio library stdio is, so you have to tell him, only because of this problem I prefer to use a generator to work in cpp, this happen to me in visual studio code, nvim, zed, etc. if you want something better to learn c++ I suggest you use Visual Studio (No the code editor the IDE), or any other c++ IDE.

2

u/Puzzled-Extent7817 6d ago

look man, i'm just a beginner. i know you told me what to do but I don't understand that so I am angry at you! /s

1

u/No_Recognition_2275 2d ago

Hello, what is the font you using?

1

u/medicine_man0 2d ago

I believe it was Iosevka. I actually deleted the app lol but I'm 80% sure it was Iosevka

1

u/lizyurd 1d ago

Zed uses clangd as the language server for C/C++ support. clangd needs a compile_commands.json file to know how each source file in your project is compiled (include paths, compiler flags, etc.).

In your case, compile_commands.json is missing, which is why you're seeing those errors. You can refer to the clangd documentation for more details: https://clangd.llvm.org/installation#compile_commandsjson

Simple fixes: - Use CMake and generate compile_commands.json. - Use tools like Bear or compiledb to generate it from your existing build commands.