r/vscode • • 10d ago

How do I fix this VS code C intellisense problem?

I was trying to make a linked list node structure (Learning Data structures). Then VS code is now marking a error at node, I cant find a fix anywhere. The error message it shows is:

Error: this declaration of struct "Node" does not declare the same type as the declaration at line 3

Meanwhile my code compiles correctly but this red underline is just making me feel uneasy. How do I fix this?

10 Upvotes

7 comments sorted by

1

u/Otherwise_Monitor856 9d ago

What is the file extension? The intelllisense might think this is C++ rather than old C. Also, did you forward declare anything or is that code the whole program?

1

u/Icy_Repeat_2460 9d ago

The extension is C and that code is the whole program and when I switch the mode to gnu17 instead of gnu23 it stops giving me the error.

1

u/Otherwise_Monitor856 9d ago

well ok, I think we're onto something there.

Can you try naming your struct to another name than "Node"? Just MyNode would work. intellisense may be finding another symbol with that name in a header file

2

u/DaveX64 10d ago

I typed it out in VSCode on Linux...don't get the red squiggly. Maybe you should check for updates if you haven't and uninstall/reinstall C/C++ Intellisense?

2

u/Key_River7180 10d ago

You need to make a compile_commands.json file. This should be generated by your build system, what is it?

-19

u/flyingron 10d ago

Get a proper IDE. VSCode sucks.