How to pass comma-separated options to the g++ linker with VSCode?

喜夏-厌秋 提交于 2021-02-05 07:49:07

问题


I need to pass the arg -Wl,-Bstatic,--whole-archive to g++.

"version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "shell: g++.exe build active file",
            "command": "C:\\MinGW\\x86\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-Wl,-Bstatic,--whole-archive",
                "-Xlinker",
                "-Map=${fileDirname}\\${fileBasenameNoExtension}.map",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\MinGW\\x86\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ]
}

It gives me in output this in the terminal.

Executing task: C:\MinGW\x86\bin\g++.exe -g 'c:\Users\remi\Desktop\OK - VSCode\loaderstack.cpp' -Wl,-Bstatic,--whole-archive -Xlinker '-Map=c:\Users\remi\Desktop\OK - VSCode\loaderstack.map' -o 'c:\Users\remi\Desktop\OK - VSCode\loaderstack.exe' <

    At line:1 char:84
    + ... e -g 'c:\Users\remi\Desktop\OK - VSCode\loaderstack.cpp' -Wl,-Bstatic ...
    +                                                                 ~
    Missing argument in parameter list.
    At line:1 char:93
    + ... Users\remi\Desktop\OK - VSCode\loaderstack.cpp' -Wl,-Bstatic,--whole- ...
    +                                                                 ~
    Missing argument in parameter list.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : MissingArgument

Is there anyway to build inside VSCode with these comma-separated args ?

来源:https://stackoverflow.com/questions/62072005/how-to-pass-comma-separated-options-to-the-g-linker-with-vscode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!