Closed Raspredval closed 1 year ago
@Raspredval Thanks for the feedback!
What is that you're trying to accomplish with the manual includePath
in the c_cpp_properties.json? @andreeis Correct me if I'm wrong, but if you're using this extension you should be able to let the Makefile extension configure intellisense for you, rather than manually specifying it in the c_cpp_properties.json
file.
Are these includePaths
paths that are not found by make and you had to set them manually because of that?
Thanks! Any information to help us repro and/or diagnose this is great!
maybe I'am using this wrong, but "includePath" works only for the intellisence. The include paths that I use for building work just fine, the build process is not affected. It's the intellisence that's breaking. Basically it stops parsing theese additional include paths and shows a lot of errors, as if it failed to include the files.
One of the primary goals of this extension is to automatically provide the includePath to the C++ extension so that you don't have to manually specify it. When that happens, the includePath you set in c_cpp_properties.json
is not used. If the Makefile Extension is not providing the correct paths for IntelliSense, then you can disable that part without disabling the whole extension. (and of course, we'd like to learn more about your project to understand why we failed to provide the correct information for IntelliSense in the first place).
To disable the automatic IntelliSense configuration, you should either:
"configurationProvider"
entry from c_cpp_properties.json
, or"C_Cpp.default.configurationProvider"
setting from settings.json
oh, I didn't know, it does that, thanks! I'll try to remove the config file and reload the extension, maybe it would get the include path for me
and it didn't work. Is there a specific way I have to structure the makefile for this to work? Anyway, I would probably disable the automatic configuration and provide the paths myself. Thanks for answering <3
We have a troubleshooting guide here: https://github.com/microsoft/vscode-makefile-tools/blob/main/docs/troubleshooting.md We also share known good configurations for popular open source repositories here: https://github.com/microsoft/vscode-makefile-tools/blob/main/docs/repositories.md
If you want to run the C/C++: Log Diagnostics
command and share the output here, we can see if anything obviously wrong is happening.
We could also take a look at your logs if you want. Set the "makefile.loggingLevel"
setting to "Debug"
and then reload the VS Code window. The logs will show up in the Output panel (choose "Makefile" from the drop-down box)
here's the c/c++ diagnostics:
-------- Diagnostics - 17.03.2023, 00:35:15
Version: 1.14.4
Current Configuration:
{
"name": "Linux",
"includePath": [
"/home/raspredval/Projects/wxWidgets/testing/**",
"/usr/include/wx-3.2",
"/usr/lib/wx/include/gtk3-unicode-3.2"
],
"defines": [],
"compilerPath": "/usr/bin/clang",
"intelliSenseMode": "linux-clang-x64",
"compilerPathIsExplicit": true,
"cStandardIsExplicit": true,
"cppStandardIsExplicit": true,
"intelliSenseModeIsExplicit": true,
"cStandard": "c99",
"cppStandard": "c++23",
"mergeConfigurations": false,
"browse": {
"path": [
"${workspaceFolder}/**",
"/usr/include/wx-3.2",
"/usr/lib/wx/include/gtk3-unicode-3.2"
],
"limitSymbolsToIncludedHeaders": true
}
}
Translation Unit Mappings:
[ /home/raspredval/Projects/wxWidgets/testing/source/App.cpp ]:
/home/raspredval/Projects/wxWidgets/testing/source/App.hpp *
Translation Unit Configurations:
[ /home/raspredval/Projects/wxWidgets/testing/source/App.cpp ]:
Process ID: 21593
Memory Usage: 116 MB
Compiler Path: /usr/bin/clang
Includes:
/usr/include/wx-3.2
/usr/lib/wx/include/gtk3-unicode-3.2
/usr/include/c++/12.2.1
/usr/include/c++/12.2.1/x86_64-pc-linux-gnu
/usr/include/c++/12.2.1/backward
/usr/lib/clang/15.0.7/include
/usr/local/include
/usr/include
Standard Version: c++23
IntelliSense Mode: linux-clang-x64
Other Flags:
--clang
--clang_version=150007
Total Memory Usage: 116 MB
------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 51153
here's the make-tools debug info
Logging level: Debug
Dropping various extension output files at /home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools
Configurations cached at /home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/configurationCache.log
No path to the makefile is defined in the settings file.
No folder path to the makefile is defined in the settings file.
Always pre-configure: false
Dry-run switches: --always-make,--keep-going,--print-directory
Additional compiler names:
Exclude compiler names:
No current configuration is defined in the workspace state. Assuming 'Default'.
No target defined in the workspace state. Assuming 'Default'.
No current launch configuration is set in the workspace state.
Default launch configuration: MIMode = undefined,
miDebuggerPath = undefined,
stopAtEntry = undefined,
symbolSearchPath = undefined
Configure on open: true
Configure on edit: true
Configure after command: true
Only .PHONY targets: false
Save before build or configure: true
Build before launch: true
Clear output before build: true
Ignore directory commands: true
compile_commands.json path: null
Deduced command 'make ' for configuration "Default"
Saving opened files before build.
Configuring from cache: /home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/configurationCache.log
Load configuration from cache elapsed time: 0.395
Sending Workspace Browse Configuration: -----------------------------------
Browse Path: /home/raspredval/Projects/wxWidgets/testing/source
Standard: undefined
Compiler Path: /usr/bin/g++
Compiler Arguments: -Wall;-Wextra;-Wconversion;-Wpedantic;-Werror;-O3;-mavx;-s;-isystem;/usr/lib/wx/include/gtk3-unicode-3.2;-isystem;/usr/include/wx-3.2;-pthread;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2;-o;./bin/release/testing;./source/App.cpp;./source/main.cpp;./source/MainFrame.cpp
----------------------------------------------------------------------------
Sending configuration (from cache) for file /home/raspredval/Projects/wxWidgets/testing/source/*.cpp -----------------------------------
Defines: WXUSINGDLL;__WXGTK3__;__WXGTK__;NDEBUG
Includes:
Force Includes:
Standard: undefined
IntelliSense Mode: undefined
Compiler Path: /usr/bin/g++
Compiler Arguments: -Wall;-Wextra;-Wconversion;-Wpedantic;-Werror;-O3;-mavx;-s;-isystem;/usr/lib/wx/include/gtk3-unicode-3.2;-isystem;/usr/include/wx-3.2;-pthread;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2;-o;./bin/release/testing;./source/App.cpp;./source/main.cpp;./source/MainFrame.cpp
---------------------------------------------------------------------------------------------------
Generating in the background a new configuration cache with command: 'make --dry-run --always-make --keep-going --print-directory'
Writing the dry-run output: /home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/dryrun.log
Spawning child process with:
process name: make
process args: --dry-run,--always-make,--keep-going,--print-directory
working directory: /home/raspredval/Projects/wxWidgets/testing
shell type: default
Generating dry-run elapsed time: 0.035
Preprocessing: "/home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/dryrun.log"
Preprocess elapsed time: 0
Parsing for IntelliSense.
Updating the CppTools IntelliSense Configuration Provider.
Parsing dry-run output for CppTools Custom Configuration Provider.
Analyzing line: make: Entering directory '/home/raspredval/Projects/wxWidgets/testing'
MAKE -C: entering directory /home/raspredval/Projects/wxWidgets/testing
Found compiler command: g++ -Wall -Wextra -Wconversion -Wpedantic -Werror -std=c++23 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -g -Og -fsanitize=address -isystem /usr/lib/wx/include/gtk3-unicode-3.2 -isystem /usr/include/wx-3.2 -pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -o ./bin/debug/testing ./source/*.cpp
Unknown C++ standard control flag: c++23
Sending configuration for file /home/raspredval/Projects/wxWidgets/testing/source/*.cpp -----------------------------------
Defines: WXUSINGDLL;__WXGTK3__;__WXGTK__
Includes:
Force Includes:
Standard: undefined
IntelliSense Mode: undefined
Compiler Path: /usr/bin/g++
Compiler Arguments: -Wall;-Wextra;-Wconversion;-Wpedantic;-Werror;-g;-Og;-fsanitize=address;-isystem;/usr/lib/wx/include/gtk3-unicode-3.2;-isystem;/usr/include/wx-3.2;-pthread;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2;-o;./bin/debug/testing;./source/App.cpp;./source/main.cpp;./source/MainFrame.cpp
---------------------------------------------------------------------------------------------------
Found compiler command: g++ -Wall -Wextra -Wconversion -Wpedantic -Werror -std=c++23 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -O3 -mavx -s -DNDEBUG -isystem /usr/lib/wx/include/gtk3-unicode-3.2 -isystem /usr/include/wx-3.2 -pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -o ./bin/release/testing ./source/*.cpp
Unknown C++ standard control flag: c++23
Sending configuration for file /home/raspredval/Projects/wxWidgets/testing/source/*.cpp -----------------------------------
Defines: WXUSINGDLL;__WXGTK3__;__WXGTK__;NDEBUG
Includes:
Force Includes:
Standard: undefined
IntelliSense Mode: undefined
Compiler Path: /usr/bin/g++
Compiler Arguments: -Wall;-Wextra;-Wconversion;-Wpedantic;-Werror;-O3;-mavx;-s;-isystem;/usr/lib/wx/include/gtk3-unicode-3.2;-isystem;/usr/include/wx-3.2;-pthread;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2;-o;./bin/release/testing;./source/App.cpp;./source/main.cpp;./source/MainFrame.cpp
---------------------------------------------------------------------------------------------------
Analyzing line: make: Leaving directory '/home/raspredval/Projects/wxWidgets/testing'
POPD command or end of MAKE -C: leaving directory /home/raspredval/Projects/wxWidgets/testing and entering directory /home/raspredval/Projects/wxWidgets/testing
Sending Workspace Browse Configuration: -----------------------------------
Browse Path: /home/raspredval/Projects/wxWidgets/testing/source
Standard: undefined
Compiler Path: /usr/bin/g++
Compiler Arguments: -Wall;-Wextra;-Wconversion;-Wpedantic;-Werror;-O3;-mavx;-s;-isystem;/usr/lib/wx/include/gtk3-unicode-3.2;-isystem;/usr/include/wx-3.2;-pthread;-lwx_gtk3u_xrc-3.2;-lwx_gtk3u_html-3.2;-lwx_gtk3u_qa-3.2;-lwx_gtk3u_core-3.2;-lwx_baseu_xml-3.2;-lwx_baseu_net-3.2;-lwx_baseu-3.2;-o;./bin/release/testing;./source/App.cpp;./source/main.cpp;./source/MainFrame.cpp
----------------------------------------------------------------------------
Parsing for IntelliSense elapsed time: 0.075
Parsing for launch targets.
Analyzing line: make: Entering directory '/home/raspredval/Projects/wxWidgets/testing'
MAKE -C: entering directory /home/raspredval/Projects/wxWidgets/testing
Found linker command: g++ -Wall -Wextra -Wconversion -Wpedantic -Werror -std=c++23 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -g -Og -fsanitize=address -isystem /usr/lib/wx/include/gtk3-unicode-3.2 -isystem /usr/include/wx-3.2 -pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -o ./bin/debug/testing ./source/*.cpp
Producing target binary: ./bin/debug/testing
Adding launch configuration:
/home/raspredval/Projects/wxWidgets/testing/bin/debug>testing()
Found linker command: g++ -Wall -Wextra -Wconversion -Wpedantic -Werror -std=c++23 -DWXUSINGDLL -D__WXGTK3__ -D__WXGTK__ -O3 -mavx -s -DNDEBUG -isystem /usr/lib/wx/include/gtk3-unicode-3.2 -isystem /usr/include/wx-3.2 -pthread -lwx_gtk3u_xrc-3.2 -lwx_gtk3u_html-3.2 -lwx_gtk3u_qa-3.2 -lwx_gtk3u_core-3.2 -lwx_baseu_xml-3.2 -lwx_baseu_net-3.2 -lwx_baseu-3.2 -o ./bin/release/testing ./source/*.cpp
Producing target binary: ./bin/release/testing
Adding launch configuration:
/home/raspredval/Projects/wxWidgets/testing/bin/release>testing()
Analyzing line: make: Leaving directory '/home/raspredval/Projects/wxWidgets/testing'
POPD command or end of MAKE -C: leaving directory /home/raspredval/Projects/wxWidgets/testing and entering directory /home/raspredval/Projects/wxWidgets/testing
Analyzing line: make: Entering directory '/home/raspredval/Projects/wxWidgets/testing'
MAKE -C: entering directory /home/raspredval/Projects/wxWidgets/testing
Analyzing line: make: Leaving directory '/home/raspredval/Projects/wxWidgets/testing'
POPD command or end of MAKE -C: leaving directory /home/raspredval/Projects/wxWidgets/testing and entering directory /home/raspredval/Projects/wxWidgets/testing
Found the following 2 launch targets defined in the makefile: /home/raspredval/Projects/wxWidgets/testing/bin/debug>testing();/home/raspredval/Projects/wxWidgets/testing/bin/release>testing()
Complete list of launch targets: /home/raspredval/Projects/wxWidgets/testing/bin/debug>testing();/home/raspredval/Projects/wxWidgets/testing/bin/release>testing()
Parsing for launch targets elapsed time: 0.007
Generating parse content for build targets.
Generating targets information with command: 'make all --print-data-base --no-builtin-variables --no-builtin-rules --question'
Writing the dry-run output: /home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/targets.log
Spawning child process with:
process name: make
process args: all,--print-data-base,--no-builtin-variables,--no-builtin-rules,--question
working directory: /home/raspredval/Projects/wxWidgets/testing
shell type: default
Generating dry-run elapsed time: 0.021
Parsing for build targets from: "/home/raspredval/.config/Code/User/workspaceStorage/efbca6373582aaf3911f3977ca59724c/ms-vscode.makefile-tools/targets.log"
Found the following 3 build targets defined in the makefile: all;debug;release
Complete list of build targets: all;debug;release
Parsing build targets elapsed time: 0.003
Configure finished. The status for all the subphases that ran:
loadFromCache: return code = 0, elapsed time = 0.395
generateParseContent: return code = 0, elapsed time = 0.035
preprocessParseContent: return code = 0, elapsed time = 0
parseIntelliSense: return code = 0, elapsed time = 0.075
parseLaunch: return code = 0, elapsed time = 0.007
dryrunTargets: return code = 1, elapsed time = 0.021
parseTargets: return code = 0, elapsed time = 0.003
Configure succeeded.
Sending telemetry: eventName = configure
properties: firstTime = "false",makeDryRun = "true",readCache = "true",isClean = "true",processTargetsSeparately = "false",resetBuildTarget = "false",triggeredBy = "configure dirty (on open), settings (configureOnOpen)",buildTarget = "(unset)"
measures: numberBuildTargets = "3",numberLaunchTargets = "2",numberIndexedSourceFiles = "1",numberMakefileConfigurations = "0",totalElapsedTime = "0.658",exitCode = "0",loadFromCache.exitCode = "0",loadFromCache.elapsed = "0.395",generateParseContent.exitCode = "0",generateParseContent.elapsed = "0.035",preprocessParseContent.exitCode = "0",preprocessParseContent.elapsed = "0",parseIntelliSense.exitCode = "0",parseIntelliSense.elapsed = "0.075",parseLaunch.exitCode = "0",parseLaunch.elapsed = "0.007",dryrunTargets.exitCode = "1",dryrunTargets.elapsed = "0.021",parseTargets.exitCode = "0",parseTargets.elapsed = "0.003"
Configure elapsed time: 0.658
Sending telemetry: eventName = settings
properties: makefile.loggingLevel = "Debug",makefile.makeDirectory = "undefined",makefile.makefilePath = "undefined"
I think it doesn't parse the include paths because I'am using the -isystem flag instead of -I. And there's a valid reason to do so: isystem tells the compiller to ignore any warnings in the included files. Since it's a well known third party library (wxWidgets) it's probably fine to ignore the warnings
I think it doesn't parse the include paths because I'am using the -isystem flag instead of -I. And there's a valid reason to do so: isystem tells the compiller to ignore any warnings in the included files. Since it's a well known third party library (wxWidgets) it's probably fine to ignore the warnings
Yes, I believe you are correct. I don't see an issue about -isystem support, but we should have one if this is not working correctly. I'll reopen this issue.
ok, if you're planning of adding support for -isystem, then you probably should expand it to support a couple more flags: https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html#Directory-Options
We support it in the C++ extension, and I had thought that we pass-through additional flags that don't have explicit support yet. If you would be willing to enable the automatic configuration again briefly, I'd like to see the log from the C++ extension with that on. The result of C/C++: Log Diagnostics
you shared earlier appeared to be without the automatic configuration enabled.
You can run the C/C++: Change configuration provider
command to quickly switch it on and off.
@bobbrow, look above in the makefile log, -isystem and the following argument look correct in compiler arguments, do you confirm? CppTools receives them as it expects. @Raspredval, something else is the problem here. We do not support yet wildcards in filenames. The use of *.cpp we parse correctly but we should expand it and send to CppTools an individual configuration entry for each cpp file we find on disk at that location. I believe that is why IntelliSense doesn't work. Is it easy for you to modify the makefile so that when make process it it displays the file names in the log? If you confirm this is the root cause, I will close this as a duplicate (searching in the meantime for the main work item that tracks wildcards).
sorry it was pretty late yesterday. If I get it right, you want me to unroll the *.cpp into individual filenames. Doing so does in fact solve the issue: the extension correctly identifies the include paths for the intellisence
So, I've been poking around, and worked out a solution for the wildcard thing: I used the shell to unroll it for me right in the makefile. Lets assume we have several source (.cpp) files in the source dir. Then we can use the $(shell ...) feature of make to unroll the *.cpp into a list of filenames. Then we can use this list as a compile argument and the make extension would successfully pick them for the intellisence:
SOURCE_DIR=__some_source_dir__
SOURCE_FILES=$(shell ls "$SOURCE_DIR"/*.cpp)
OUTPUT_DIR=__some_output_dir__
all:
g++ $(SOURCE_FILES) -o $(OUTPUT_DIR)/out
BTW, it looks like the make extension doesn't recognize the c++ standard version from the makefile and then overrides the user settings for intellisence with the default value of c++17. Maybe you can use the user settings value instead of the default value if it failed to parse or something.
@Raspredval , we are behind with standard updates. Thanks for pointing that out. We will quickly include 23 to the recognized list. Quick fix, will make it into 0.7 release (next week if all goes well). I will leave this work item open to track this standard update in our code base and will change title.
Regarding wildcard, I mentioned earlier the link to the work item that tracks our intention to expand the * in whatever the current folder we calculated we are in, grab all the c/c++ files we find and create a configuration entry for each with all that we parse from that compiler command. Future release, we didn't triage yet when.
It's great that you found the convenient workaround with the $(shell) construct. That reminded me that we have another work item that got pulled out of 0.7 (because of some safety and testing we need to do more) but will make it into 0.8, regarding safe commands (expanding `) which will also be able to achieve this (not supported on windows since backticks have different meaning on that system).
Quick question (I can also check myself later): the $(shell) construct in a makefile works on windows as well? If you change ls with dir, of course. If you happen to know or is handy to try. I'll find out soon.
The backtick work item is this: https://github.com/microsoft/vscode-makefile-tools/pull/409.
thanks, I can try setting up a virtual windows machine, but it probably should work as well. https://www.gnu.org/software/make/manual/html_node/Shell-Function.html
@Raspredval , no worries , don't setup a windows vm, I got my answer. Thank you for the link.
@Raspredval, @gcampbell-msft merged in a fix for your request and will be released with 0.7 next week but if you would like to see how this works earlier you can install one vsix from this link.
go to the Extensions panel on the left click "..." run "Install from vsix" from the context menu
Let us know if you encounter any other issues or if you have any other suggestions/recommendations for this extension.
@andreeis I've tried it and it still requires unrolling the wildcard (via $(shell ...)) or by hand. But the standard bug got fixed, it now recognizes the -std=c++20 (but not the -std=c++23, which IS supported by c++ extension) flag. Plus there's another issue: the make extension applies the extracted settings only for the source files listed in the build command. For example, I have an aggregate header file, that gathers all the common system includes: that header works just fine if it's included in one of the source files, but doesn't work on it's own then it's not included in any of the source files.
@Raspredval, I didn't mean that we fixed the $(shell) part :), only the c/c++ standard part but thanks for you trying out the vsix and letting us know it doesn't work for 2023. This way we realized we missed one piece and submitted an update PR. Regarding the header, it is by design that we don't see it when standalone but only when included in another c/c++ source file because only then it becomes a translation unit. Any design change regarding how IntelliSense works for standalone headers would belong to CppTools (our sister extension), not Makefile Tools.
Forgot to close this one. 0.7.0 is released and unless I overlook anything, all the issues touched in this ticket are either answered or by design / won't fix or fixed and released. Please reactivate if there is anything I missed.
Enabling the make extention breaks the include paths, specified in the c_cpp_properties.json: "includePath". It asks to configure something intellisence related when the extension is loading; that's exactly what breaks intellisence to stop looking for those additional include paths. But if you manually disable the make extension, reload vscode and enable the extension back it starts working again.
I'am using the latest makefile-tools extension, the release version of c/c++ extension (although this keeps breaking in the pre-release version as well) and this is my vscode version:
Version: 1.76.2 Commit: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884 Date: 2023-03-14T17:57:21.103Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Linux x64 6.1.12-1-MANJARO Sandboxed: No