microsoft / vscode-cpptools

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

Example using MSYS produces no output #9020

Closed maacl closed 6 months ago

maacl commented 2 years ago

VS Code Version: Version: 1.65.1 (user setup) Commit: https://github.com/microsoft/vscode/commit/8908a9ca0f221f36507231afb39d2d8d1e182702 Date: 2022-03-08T02:06:27.846Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.22000

Extension Version: v1.8.4

OS Version: OS: Windows_NT x64 10.0.22000

MSYS Version: msys2-x86_64-20220128.exe (installer)

task.json:

{ "version": "2.0.0", "tasks": [ { "type": "cppbuild", "label": "C/C++: g++.exe build active file", "command": "C:\msys64\mingw64\bin\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", "${file}", "-o", "${fileDirname}\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$gcc" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: C:\msys64\mingw64\bin\g++.exe" } ] } Steps to Reproduce:

1.Follow tutorial to this step https://code.visualstudio.com/docs/cpp/config-mingw#_add-hello-world-source-code

  1. Code builds but running resulting exe does not produce any output.
  2. If I skip the use of "using namespace std;" and prefix all with "std::", output is produced as expected.
maacl commented 6 months ago

Any news re this. I have just reinstalled a new machine, and this is still an issue.

sean-mcmanus commented 6 months ago

@maacl I'm not sure what is going on. What version of g++ (via g++ --version) are you using and what -std version is being used? You could try adding a "-std=c++17" arg.

maacl commented 6 months ago

I think I solved this. For some reason gcc was used instead fo g++.

On Sat, 27 Apr 2024 at 03:18, Sean McManus @.***> wrote:

@maacl https://github.com/maacl I'm not sure what is going on. What version of g++ (via g++ --version) are you using and what -std version is being used? You could try adding a "-std=c++17" arg.

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-cpptools/issues/9020#issuecomment-2080298256, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAPUXGW36V65QRZ6QIF2QDY7L4GLAVCNFSM5QVJPQ5KU5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBYGAZDSOBSGU3A . You are receiving this because you were mentioned.Message ID: @.***>