vscode 下编译window api

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "command": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\msbuild",
            "args": [
                "myapp.vcxproj",
                "/property:GenerateFullPaths=true",
                "/t:build",
                "/p:TargetVersion=Windows10",
                "/p:TargetPlatformVersion=10.0.17763.0",
                "/consoleloggerparameters:NoSummary"
            ],
            "group": "build",
            "presentation": {},
            "problemMatcher": "$msCompile"
        },
        {
            "label": "gccbuild",
            "type": "shell",
            "command": "C:\\Program Files\\mingw-w64\\x86_64-8.1.0-win32-seh-rt_v6-rev0\\mingw64\\bin\\gcc",
            "args": [
                "main.cpp",
                "-mwindows",
                "-o my.exe"
            ],
            "group": "build",
            "presentation": {},
            "problemMatcher": [
                "$gcc"
            ]
        },
        {
            "type": "shell",
            "label": "cl.exe build active file",
            "command": "cl.exe",
            "args": [
                "/Zi",
                "/EHsc",
                "/Fe:",
                "${fileDirname}\\${fileBasenameNoExtension}.exe",
                "${file}"
            ],
            "problemMatcher": [
                "$gcc"
            ],
            "group": "build"
        }
    ]
}

 经过测试,msbuild和mingw-w64下的gcc都可以执行编译,msbuild可以使用node下的windows-build-tools模块来安装,安装过程中会安装msbuild和py。

posted @ 2019-09-12 15:23  空空复空空  阅读(1117)  评论(0编辑  收藏  举报