#Need help with g++ compiler on VSCode with Msys64

24 messages · Page 1 of 1 (latest)

coral cargo
#

Background Knowledge:

  • I've setup msys64 on the desktop, and I've set this up on my laptop before.
  • It works perfectly on the laptop apart from msys64 not supporting wildcard statements anymore(but its not a big problem).
  • I followed all the same steps to set it up on my desktop.

Problem:
I have a code snippet where i use a ifstream to read a txt file but the compiler doesn't open the file. I check the json and the cwd: isn't set to ${fileDirname} even though its automatically built. Still doesn't work, and i figure out my command: has forward slashes rather than backwards ones. Change both of those and it finally works as intended. The reason i got a problem is when i auto build on my laptop, it does these 2 things automatically, while my desktop builds broken. Is there anyway i can fix this?

Previous Json ( What does read any files in the directory and what auto builds for my desktop):

            "command": "C:/msys64/ucrt64/bin/g++.exe",
            "options": {
                "cwd": "C:/msys64/ucrt64/bin"
            },

^^This is the difference between the working and the previous json.

Working Json(What my laptop builds and what works on the desktop):

{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "C:\msys64\ucrt64\bin\g++.exe",
            "args": [
                "-fdiagnostics-color=always",
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger."
        }
    ],
    "version": "2.0.0"
}
dense shardBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

dense shardBOT
robust dune
#

format it with ```json

coral cargo
#

gotcha

robust dune
#

you need close too

#

with ```

coral cargo
#

sorry

robust dune
#

it called codeblock

#

markdown

#

and above too

coral cargo
#

Alrighty

robust dune
#

nice now it readable

coral cargo
#

tyty

pure harbor
#

So your question is why the automatic generation is different?

coral cargo
#

Pretty much and how could i change it

pure harbor
#

Can you show how you generate it?

#

Tbh I think it's not a big deal, I'd just paste the working one

#

Also FYI I think MSYS2 fixed the wildcards, they should work if you update

coral cargo
#

Wonderful, also im just really curious as to why. The way i generate is when i click run for the first time or when i dont have a tasks.json and it asks for a build i choose the g++. Then it just makes the tasks.

pure harbor
#

I'd start by comparing what extensions you have installed, and whether you have something different in settings.json

coral cargo
#

ALrighty thanks

#

!solved