-
Hello, I would like to be able to compile a simple program in C/C++ with Visual Studio Code and mingw-w64. So, I have installed Mingw-w64 (following the doc on https://www.msys2.org/)
So, I create my working folder, add helloworld.cpp file with example on the doc and that's where the problems start. My c_cpp_properties.json file:
So, as I saw in the FAQ, I try to modify my "includePath" in c_cpp_properties.json by adding include folder (D:/Dvpt/msys64/ucrt64/include/**)
As you can see, squiggles under Standard Library types disappeared but I have another error Strangely I haven't found an answer to my problem on the web and very few people seem to have this problem. I have spend hours trying to correct the problem but without success.
And to finish, here is my C/C++ Log diagnostics
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 7 replies
-
Can you please do the following 3 things?
With the debug logging enabled, it should hopefully tell us why getting the proper include path from your MinGW installation is failing. Copy and paste that log here and we can see what the next steps are. |
Beta Was this translation helpful? Give feedback.
-
Hi @bobbrow, Thanks for your answer.
I noticed interesting thing like: "No suitable compiler found. Please set the "compilerPath" in c_cpp_properties.json."
|
Beta Was this translation helpful? Give feedback.
-
It appears to query for C just fine, but appears to be failing to query C++ information. Also strange is that it is asking for C++98 instead of C++17 which is what your original log showed you were requesting. Can you try running the following commands in a terminal window (not VS Code's terminal) and let me know what happens?
EDIT: removed the |
Beta Was this translation helpful? Give feedback.
-
I have read the following doc: https://code.visualstudio.com/docs/languages/cpp And I have download the compiler from the ling inside the doc: As you can see, the link points to msys2-x86_64-20240113.exe (the one I have installed) But on the first page, there is another "old" link: You are right, I will uninstall MinGW from my previous install and try the "old" one. |
Beta Was this translation helpful? Give feedback.
-
I have installed the "previous" version and now when I execute the following command line I have this:
gcc.exe -std=c++17 -Wp,-v -E -dM -x c++ nul
And now, in the outpout debug window I have this:
|
Beta Was this translation helpful? Give feedback.
-
With the "previous" install form the link below it works very well:
I can compile a simple HelloWorld at least 👍 |
Beta Was this translation helpful? Give feedback.
It looks like the 2024 mingw version we link to installs g++ version 13.2. The MSYS2 website has a newer version of the installer that installs version 14.2 of g++. However, I didn't have any problems running the commands above with version 14.2. I'm hoping that maybe simply reinstalling will fix your problem.