簡體   English   中英

使用 VS Code 在 Linux 上使用 MinGW 交叉編譯適用於 Windows 的 SDL 程序?

[英]Cross-compile SDL programs for Windows with MinGW on Linux in VS Code?

我想用 VSCodium 創建一個 IDE,我可以在其中交叉編譯 Linux 和 Windows 上的 Linux 程序。 我想將 SDL2 與它一起使用,但我在使用 Windows 的 MinGW 和 g++ 時遇到問題。 也許有人知道正確的 g++ 命令。 目前我得到了這個:

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build-C++-SLD2-Linux",
            "type": "shell",
            "command": "g++",
            "args": [
                "-g",
                "*.cpp",
                "-I/usr/include/SDL2",
                "-lSDL2",
                "-o",
                "App.exe"
            ],
            "group": "build"
        },
        {
            "label": "build-C++-SLD2-Windows",
            "type": "shell",
            "command": "g++",
            "args": [
                "*.cpp",
                "-I/usr/include/SDL2",
                "-lSDL2",
                "-lSDL2main",
                "-L/usr/x86_64-w64-mingw32/bin",
                "-o",
                "AppWin64.exe"

            "group": "build"
            ],
        },
        {
            "label": "build-C++-SLD2-Windows-alt",
            "type": "shell",
            "command": "x86_64-w64-mingw32-g++",
            "args": [
                "-g",
                "*.cpp",
                "-I/home/username/Dokumente/SDL2",
                "-L/home/username/Dokumente/lib",
                "-L/usr/x86_64-w64-mingw32/bin",
                "-lSDL2",
                "-o",
                "AppWin.exe"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ],
    "group": {
        "kind": "build",
        "isDefault": true
    },
    "problemMatcher":"$gcc"
}

如果您遇到和我一樣的問題,使用一些外部軟件進行編譯會更容易(編寫 shellscript 或使用 make)。 因為如果你有一個更大的項目,你可以很容易地在問題中運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM