microsoft / vscode-makefile-tools

MAKE integration in Visual Studio Code
Other
196 stars 60 forks source link

command-line error: language modes specified are incompatibleC/C++(1027) #219

Closed lab313ru closed 2 years ago

lab313ru commented 3 years ago

My project has the following settings:

"cStandard": "c99",
"cppStandard": "c++03",
"intelliSenseMode": "windows-gcc-x86",
"configurationProvider": "ms-vscode.makefile-tools"

After every reopening of the project this problem happens and doesn't allow to build anything. The only solution is to disable then enable the extension. After that everything does work. But after you'll close VScode the problem will appear again.

andreeis commented 3 years ago

@lab313ru, thank you for creating this issue. Can you set "makefile.loggingLevel" to "Debug" and "makefile.extensionLog" to "extension.log" in your project .vscode/settings.json, reload your project in VSCode, let it finish configuring (you should see something like "configure finished" in the Makefile Tools output channel), then share with us the files .vscode/dryrun.log and .vscode/extension.log? And let us know what source file exhibits this problem, so we track that file name in the logs.

Also, does the same happen if you open the c/c++ source file after configure finishes? I am asking in case there may be a bug about updating the IntelliSense information after configure finishes, when a file is opened before we have that available.

If your project is easy to share with us entirely, we can do all the investigation on our side.

lab313ru commented 3 years ago

dryrun.log extension.log

It's happens for core.c file at its first line.

What I'm doing to reproduce is:

  1. Open VS Code (by default it opens the last opened, so the current, project)
  2. Problem appears
  3. Disable extension, then reload VS Code
  4. Enable extension
  5. Problem disappears
  6. Close then open VS Code to make this problem appear again
andreeis commented 3 years ago

@lab313ru, thank you for the files. The disable/enable is a mystery for me (the squiggle should not disappear) but at least I spotted something in the logs you sent.

In what kind of environment you are opening VSCode? Is it MinGW? If yes, Is "cygpath" command working properly in that environment? What does it output for "cygpath \d\SGDK_projects\clock_tower\src\core.c -w" ?

lab313ru commented 3 years ago

No MinGW or Cygwin paths were added to PATH. I'm just using a folder with all executables I need and passing its path to the variable in my Makefile.

For more information I recommend you to look at the project which executables I use: https://github.com/Stephane-D/SGDK/blob/master/makefile.gen

Here, at the top of this file I'm just setting up GDK variable to point at the SGDK's bin/ folder. That's it

Andreea Isac @.***> 6 октября 2021 г. 12:22:25 написал:

@lab313ru, thank you for the files. The disable/enable is a mystery for me (the squiggle should not disappear) but at least I spotted something in the logs you sent. In what kind of environment you are opening VSCode? Is it MinGW? If yes, Is "cygpath" command working properly in that environment? What does it output for "cygpath \d\SGDK_projects\clock_tower\src\core.c -w" ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

andreeis commented 3 years ago

I see that this repository supports linux and mac development. Is the extension working fine on those systems?

For windows, if you open VSCode from MinGW prompt (just try as an experiment, it may unblock you) and load your project, is the extension working?

If you run from pure windows environment, I wonder why do we see paths like /d/ (instead of d:) in dryrun.log. Why make.exe reports entering or leaving directory with that folder syntax. I never saw that happen on pure windows, only in MinGW and the extension is able to catch this scenario. But since you are not running from MinGW, we are not doing a path syntax conversion on "/d/SGDK_project/..." and when CppTools (the extension which actually does the IntelliSense calculations) asks for file "d:\SGDK_projects\clock_tower\src\core.c", we don't find it because we registered "\d\SGDK_projects\clock_tower\src\core.c".

I will clone the sgdk repository and see for myself later this week, if we don't get to the root cause by then.

lab313ru commented 3 years ago

I really don't know why it uses /d/. Maybe because WSL2 is installed? But I don't use it during the project build. GDK variable is set like this: GDK := d:/git/SGDK

Andreea Isac @.***> 6 октября 2021 г. 12:51:30 написал:

I see that this repository supports linux and mac development. Is the extension working fine on those systems?

For windows, if you open VSCode from MinGW prompt (just try as an experiment, it may unblock you) and load your project, is the extension working?

If you run from pure windows environment, I wonder why do we see paths like /d/ (instead of d:) in dryrun.log. Why make.exe reports entering or leaving directory with that folder syntax. I never saw that happen on pure windows, only in MinGW and the extension is able to catch this scenario. But since you are not running from MinGW, we are not doing a path syntax conversion on "/d/SGDK_project/..." and when CppTools (the extension which actually does the IntelliSense calculations) asks for file "d:\SGDK_projects\clock_tower\src\core.c", we don't find it because we registered "\d\SGDK_projects\clock_tower\src\core.c".

I will clone the sgdk repository and see for myself later this week, if we don't get to the root cause by then.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-makefile-tools/issues/219#issuecomment-935870368, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABW3GPJ4KDYBTGVET2FVYT3UFQL2DANCNFSM5FMOSIBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

andreeis commented 3 years ago

Ok, it's still worth for you to try to open VSCode from a MinGW command prompt. You might get unblocked. Or another idea, create yourself a full clean build log of your project, change by hand paths like /d/ into d:\ and point the modified log to the extension via "makefile.buildLog". This will cause the extension to parse all the useful information from the log, without invoking "make --dry-run --and-other-switches" and thus avoiding the path syntax incompatibility problem.

lab313ru commented 3 years ago

MinGW is not ok for me. It doesn't support m68k, but SGDK's old variant of gcc does.

andreeis commented 3 years ago

@lab313ru, please remind me, how do you open VSCode. From the "windows" button, the regular windows command prompt (cmd.exe), some other kind of terminal? I understand you don't use mingw, msys or wsl.

Without doing anything extra, the environment that you use, does it have cygpath tool on the path?

lab313ru commented 3 years ago

I use vscode icon at my desktop, Windows.

Andreea Isac @.***> 17 ноября 2021 г. 00:21:21 написал:

@lab313ru, please remind me, how do you open VSCode. From the "windows" button, the regular windows command prompt (cmd.exe), some other kind of terminal? I understand you don't use mingw, msys or wsl.

Without doing anything extra, the environment that you use, does it have cygpath tool on the path?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

andreeis commented 3 years ago

@lab313ru, I am working on fixing this and I am not ready yet but it would help if you install this vsix and let me know how it works for you. Even if the coding of the fix is still in the experimental/hacky phase, it should be functional and verifying if it works or not would help us continue on the right track.

  1. Extensions panel from the left side of VSCode
  2. Context menu of "..." in the upper right of the extensions panel window.
  3. Run "Install from vsix" and point to what you download from this link.
lab313ru commented 3 years ago

It looks like it works fine!

ср, 17 нояб. 2021 г. в 03:37, Andreea Isac @.***>:

@lab313ru https://github.com/lab313ru, I am working on fixing this and I am not ready yet but it would help if you install this vsix and let me know how it works for you. Even if the coding of the fix is still in the experimental/hacky phase, it should be functional and verifying if it works or not would help us continue on the right track.

  1. Extensions panel from the left side of VSCode
  2. Context menu of "..." in the upper right of the extensions panel window.
  3. Run "Install from vsix" and point to what you download from this link https://github.com/microsoft/vscode-makefile-tools/actions/runs/1469445456 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-makefile-tools/issues/219#issuecomment-970939158, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABW3GPIBPJXWJ2PXM3AFU73UML2MRANCNFSM5FMOSIBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

andreeis commented 2 years ago

@lab313ru, great to hear that. We also release 0.3.0 today on GitHub and Microsoft Market Place. Let us know if you encounter any other issues.

andreeis commented 2 years ago

@lab313ru, if you would like, you can also leave us a review on Market Place.

hardik-rajpal commented 1 year ago

If anyone stumbles here with the same error, getting rid of the "configurationProvider": "ms-vscode.makefile-tools" line in c_cpp_properties.json file worked for me.

1a1a11a commented 1 year ago

If anyone stumbles here with the same error, getting rid of the "configurationProvider": "ms-vscode.makefile-tools" line in c_cpp_properties.json file worked for me.

This is very helpful! Any thoughts on why this line comes back after I removed it a few days ago?

bobbrow commented 1 year ago

Two issues here:

andreeis commented 1 year ago

@1a1a11a, for a quick check on whether Makefile Tools is not sending or is sending wrong configurations for C/C++ extension, you can set "makefile.loggingLevel": "Debug", "makefile.extensionOutputFolder": "./OutputFolderLogs", "makefile.extensionLog": "extension.log" in your ".vscode/settings.json", then reload your project, let it finish configure (watch for "Configure finished" in the "Makefile Tools" output channel) and share with us files from "OutputFolderLogs": dryrun.log and extension.log, together with the name and full path of the c/c++ source file that has wrong IntelliSense. All this while having "ms-vscode.makefile-tools" set as "configurationProvider".

1a1a11a commented 1 year ago

Thank you! Where should I place the "ms-vscode.makefile-tools"? I tried the following, but it looks like I have put it in the wrong place.

image
bobbrow commented 1 year ago

Thank you! Where should I place the "ms-vscode.makefile-tools"? I tried the following, but it looks like I have put it in the wrong place.

The location is correct, but the strings are reversed. It should be:

"configurationProvider": "ms-vscode.makefile-tools"

musteresel commented 1 year ago

Commenting in case someone else stumbles upon this and perhaps made a similar mistake to mine:

I've got this error due to a) compile_commands.json not being generated by CMake (fixed by adding set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "I want compile_commands.json" FORCE) at the top of my CMakeLists.txt, and b) compile_commands.json wrongly being "created" by having "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/build/compile_commands.json" in my settings.json, which caused a SQLITE3 database to be created as "compile_commands.json".

David00154 commented 1 year ago

if you have cmake tools installed in vscode extensions, disable and reload :)

andreeis commented 1 year ago

@musteresel, indeed as @David00154 also mentions, it doesn't make sense to use Makefile and CMake Tools extensions at the same time in VSCode. Depending on what build system is set up for your code base, pick one and disable the other. Also, just know that also Makefile Tools can generate a compile_commands.json if you give a path via the setting "makefile.compileCommandsPath".

vformanyuk commented 1 year ago

For anyone still hitting this error (with Maketools 0.8.14), check that problematic source file is mentioned in makefile and build from Makefile tools menu. This should make this error gone and reenable intellisence. image