如何在task.json 中转换大Makefile - VScode - C++?

问题描述 投票:0回答:0

问题

我正在尝试使用 task.json 来构建我的项目而不是 Makefile,但是当我将 Makefile 参数放入 task.json 并运行该任务时,我收到错误。

我在寻找什么:

我希望将我的 Makefile 转换为 task.json,但是当我这样做时,这不起作用。

生成文件

all:
    cls
    g++ -D_GNU_SOURCE -I src/include -L src/lib -o TKM main.cpp ressources.o src/include/manmade/Class/* src/include/manmade/Components/* src/include/manmade/Part/* src/include/manmade/Declaration/* -lmingw32 -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf
    ./TKM

任务.json

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "cppbuild",
            "label": "G++ tasks",
            "command": "g++",
            "args": [
                "-std=c++23",
                "-D_GNU_SOURCE",
                "-I src/include",
                "-L src/lib",
                "-o TKM2",
                "main.cpp",
                "ressources.o",
                "src/include/manmade/Class/*",
                "src/include/manmade/Components/*",
                "src/include/manmade/Part/* ",
                "src/include/manmade/Declaration/*",
                "-lmingw32",
                "-lSDL2main",
                "-lSDL2",
                "-lSDL2_image",
                "-lSDL2_ttf"

            ],
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build",
            "detail": "compiler: C:\\mingw64\\bin\\g++.exe"
        }
    ]
}

重要细节:

操作系统:Windows

c++ visual-studio-code makefile
© www.soinside.com 2019 - 2024. All rights reserved.