【发布时间】:2020-02-26 04:12:36
【问题描述】:
我想用 VSCodium 创建一个 IDE,我可以在其中交叉编译 Linux 和 Linux 上的 Windows 程序。我想将 SDL2 与它一起使用,但我在使用 MinGW 和 g++ for Windows 时遇到了问题。 也许有人知道正确的 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 或其他构建工具可能会更好。
标签: c++ visual-studio-code g++ mingw sdl