-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler query should handle GCC-like compilers that support C but not C++ (i.e. Microchip's XC16) #7534
Comments
With C_Cpp.loggingLevel set to "Debug" can you look in the "C/C++" logging for a failure message after "Compiler query command line: "? I don't see that in your existing logging. |
The logs are extremely long, so I didn't include all of them. Here they are:
|
Curious. It looks like the compiler query is insisting on adding Does the XC16 compiler support only C, and not C++? At this link, I noticed the following: It would seem likely that this issue is lack of support for querying gcc-like C compilers that do not support C++. @ReimuNotMoe Could you confirm that the compiler you are using does not support C++? |
Yes. Only C is officially supported by XC16, however there are unofficial community support for C++98 (by modifying the XC16 build script). There are many other compilers that follows GCC's usages and only supports C, such as some 8051 MCU compilers. I think you can simply check if |
Addressing this would seem to require deciding how to handle C++ files if opened. Perhaps it should fall back to auto-detected defaults (a C++ compiler found on the system), though that would require tracking 2 active configurations where currently only 1 is tracked. Or, perhaps it should simply disable IntelliSense for C++ files, and/or display a warning. |
We could also potentially add cppCompilerPath/Args and cCompilerPath/Args settings (there are other scenarios were having 2 settings would be useful when using both C and C++ with compilerArgs that are only valid with one of the languages). |
I had a similar issue, solved adding the following lines to the "compilerArgs" entry in c_cpp_properties.json:
|
Bug type: Language Service
Describe the bug
System include path can't be pulled from Microchip's XC16 compiler.
I have a PIC24 MCU project which uses CMake and worked well in CLion.
When I open the project in VSCode, it can be correctly built by clicking on the Build button. However, all
#include <xc.h>
lines are red underlined.The compiler path is already set in
CMakeLists.txt
. I tried to mess withcompilerPath
andincludePath
inc_cpp_properties.json
, and none of them worked.The XC16 is a modified GCC and its usages are exactly same as GCC.
Steps to reproduce
compilerPath
inc_cpp_properties.json
to/opt/microchip/xc16/v1.70/bin/xc16-gcc
#include <xc.h>
lines are still red underlined./opt/microchip/xc16/v1.70/support/**
(which contains thexc.h
file) toincludePath
inc_cpp_properties.json
#include <xc.h>
lines are still red underlined.C/C++: Log Diagnostics
, and there are no lines begin with/opt/microchip/xc16/v1.70/support/
.Expected behavior
There shouldn't be any red underlines in code.
Code sample and logs
c_cpp_properties.json
C/C++: Log Diagnostics
from the VS Code command palettexc16-gcc
preprocessor output:Screenshots
The text was updated successfully, but these errors were encountered: