Is it possible to run/compile GAMS code in VS Code?



The tittle says it all: Can I run my GAMS code ( saved in .gms files) in Visual Studio Code?

There is an extension with the following description:
"Provides syntax highlighting for .gms and .inc files and shortcuts for running GAMS models."

I use MAC

Daniel Duffy

C++ author, trainer
From Wiki for GAMS I found

Application Programming Interfaces

GAMS - Download


Without a valid GAMS license the system will operate as a free demo system.

Model limits

  • Number of constraints and variables: 300
  • Number of nonzero elements: 2000 (of which 1000 nonlinear)
  • Number of discrete variables: 50 (including semi continuous, semi integer and member of SOS-Sets)
Additional Global solver limits

  • Number of constraints and variables: 10
The GAMS log will indicate that your system runs in demo mode

Daniel Duffy

C++ author, trainer
Ok, I installed Gams and a C++ console project which I can run. Very easy.
BTW I use Windows.

#include "gams.h"

#include <iostream>

using namespace gams;

using namespace std;

int main(int argc, char* argv[])


    GAMSWorkspace ws;


    // create a GAMSJob from file and run it with default settings

    GAMSJob t1 = ws.addJobFromFile("trnsport.gms");;

    for (GAMSVariableRecord rec : t1.outDB().getVariable("x"))

        cout << "x(" << rec.key(0) << "," << rec.key(1) << "):" << " level=" << rec.level() << " marginal=" << rec.marginal() << endl;
Last edited: