Skip to main content

HOW TO CONFIGURE THE C++ RUNTIME ENVIRONMENT IN VSCODE

Answered

Comments

1 comment

  • Riley Clement
    • Gurobi Staff

    Hi Lei Yu,

    I was able to run C++ through VSCode by following this guide:

    https://code.visualstudio.com/docs/cpp/config-msvc

    If it helps, my tasks.json file looks like this:

    {
       "tasks": [
           {
               "type": "cppbuild",
               "label": "C/C++: g++ build active file",
               "command": "/usr/bin/g++",
               "args": [
                   "-fdiagnostics-color=always",
                   "-g",
                   "${file}",
                   "-o",
                   "${fileDirname}/${fileBasenameNoExtension}",
                   "-I/Library/gurobi1202/macos_universal2/include",
                   "-L/Library/gurobi1202/macos_universal2/lib",
                   "-lgurobi_c++",
                   "-lgurobi120"
                   
               ],
               "options": {
                   "cwd": "${fileDirname}"
               },
               "problemMatcher": [
                   "$gcc"
               ],
               "group": {
                   "kind": "build",
                   "isDefault": true
               },
               "detail": "Task generated by Debugger."
           }
       ],
       "version": "2.0.0"
    }

    It may work for you once you make any changes that you need to (e.g. Gurobi version, paths etc).

    I use this with “Terminal → Run build task …”

    - Riley

     

    0

Please sign in to leave a comment.