jack06215
11/5/2018 - 9:17 AM

Setup C++ project

How to setup a C++ project in Visual Studio Code

  1. add MinGW to "Env" "C:\MinGW\bin"
  2. edit the following config files
  • c_pp_properties.json
  • launch.json
  • tasks.json
{
    "configurations": [
        {
            "name": "MinGW",
            "intelliSenseMode": "clang-x64",
            "compilerPath": "C:\\tools\\mingw-8.1\\mingw32\\bin\\gcc.exe",
            "includePath": [
                "${workspaceRoot}"
            ],
            "defines": [
                "_DEBUG"
            ],
            "browse": {
                "path": [
                    "C:\\tools\\mingw-8.1\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.1.0\\include",
                    "C:\\tools\\mingw-8.1\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.1.0\\include-fixed",
                    "C:\\tools\\mingw-8.1\\mingw32\\include\\*",
                    "${workspaceRoot}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/bin/main.exe",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}",
            "environment": [],
            "externalConsole": true,
            "preLaunchTask": "build",
            "miDebuggerPath": "C:\\tools\\mingw-8.1\\mingw32\\bin\\gdb.exe",
            "linux": {
                "MIMode": "gdb"
            },
            "osx": {
                "MIMode": "lldb"
            },
            "windows": {
                "MIMode": "gdb"
            }
        }
    ]
}