microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

C++ bugs #8349

Closed ilobilo closed 2 years ago

ilobilo commented 2 years ago
  1. If I use NULL I get error squiggle under it with message: NULL expands to _null identifier _null is undefined
  2. If I use asm volatile I get error squiggle under volatile with error message: expected (
  3. If I use C/C++ defines from extensions settings I get this error: DEFINE_NAME expands to \"text here\" so vscode thinks that define_name is \"text here\" instead of "text here"
ilobilo commented 2 years ago
  1. If I include stdint.h when vscode is set to linux-clang-x64 I get error: "gun/stubs32.h" dependency of stdint.h not found
Colengms commented 2 years ago

Hi @ilobilo . Could you provide the output of the C/C++: Log Diagnostics command, with a file open that reproduces these issues? That should provide us with information on how IntelliSense is configured for that file. Could you provide example code that you are using to reproduce these issues, as well as your configuration (contents of c_cpp_properties.json or relevant C_Cpp.* settings), so that we can reproduce and investigate these issues?

For # 3, could you also provide the setting you are using to provide the value of this define?

For # 4, Does the same code that reproduces this issue also compile successfully? The locations of system headers are determined by querying the compiler (either the default compiler, or one you specified in your configuration).

ilobilo commented 2 years ago

output of log diagnostics: https://termbin.com/q5tc also it compiles normally, no errors from clang For # 3.

"defines": [
       "GIT_VERSION=0",
       "KERNEL_VERSION=0"
],
Colengms commented 2 years ago

Hi @ilobilo . I see from your diagnostics logs that your project is configured to use the Makefile Tools extension, to provide IntelliSense configurations to the C/C++ extension. And, it also appears that your project is (or involves) the Linux kernel.

It's unclear to me whether Makefile tools itself has been configured, as there does not appear to be any custom configuration information reflected in your log. Rather, the file you opened appears to be using only your base configuration specified in c_cpp_properties.json. Since it looks like you working with Linux kernel source code, using Makefile Tools would be the correct way to get things configured, as there are numerous defines and include paths that would otherwise need to be specified in c_cpp_properties.json to get proper IntelliSense for Linux kernel sources. If you're having difficulty configuring the Makefile Tools extension, its repo is here: https://github.com/microsoft/vscode-makefile-tools

For # 3, The defines you specified don't appear to include the DEFINE_NAME macro you indicated was not being defined correctly.

ilobilo commented 2 years ago

hey @Colengms I'm not building the Linux kernel, this is my own osdev project Also DEFINE_NAME was not real name I meant KERNEL_VERSION and GIT_VERSION defines by that

Colengms commented 2 years ago

Hi @ilobilo . Your # 3 refers to quoted text within a macro, but those macros do not have quotes in them. So, I'm not sure how to help you with that issue.

Do you still have issues here that are not yet addressed? If so, could you please provide clear, stand-alone examples that we can use to fully reproduce those issues ourselves, to investigate further?

github-actions[bot] commented 2 years ago

This issue has been closed automatically because it needs more information and has not had recent activity.