Copyright ©

Mongoose OS Forum


Getting started - using C/C++ and Visual Studio?

Hi, I'm just about to get started with development on the Mongoose OS platform (for a custom ESP32 board).

From what I understand it's possible to do both Javascript and C development. Is there any performance difference between the two approaches in Mongoose? My project requires a high-performant system, so if the javascript runtime engine is slower than the C approach, I'll go for C.

Also, is anyone using Microsoft Visual Studio as their C editor for the Mongoose projects? Is there any specific settings that should be set to develop directly via VS?


  • SergeySergey Dublin, Ireland

    JS is faster to prototype, but the FW size is bigger and it is slower.
    If you need speed, C is your choice.

    You can use any editor, we use all sorts of editors, vim and Windows notepad to mention few.
    The thing is that you'd need to attach mos build, etc, to the VS. Not sure if that is possible, haven't used VS since MSVC 6 since 1998

  • Visual Studio Code is much better for developing Mongoose OS in C. I've set up tasks.json to run mos build and it even parses the gcc output.

    It has C/C++ extensions and you can specify include paths for intellisense.

  • Contents of my tasks.json

        "version": "0.1.0",
        "command": "mos",
        "args": ["build"],
        "problemMatcher": {
            "owner": "cpp",
            "fileLocation": ["relative", "${workspaceRoot}"],
            "pattern": {
                "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
                "file": 1,
                "line": 2,
                "column": 3,
                "severity": 4,
                "message": 5
  • FrodeLFrodeL Norway
    Thanks, I'll try VS Code!

    How do you set the include dirs? And where to point them? Currently I've only downloaded mos.exe, and it seems to automagically get the rest of the source during a 'mos build'. To set up Include Dirs do I have to clone the Mongoose-OS repi locally first?
  • FrodeLFrodeL Norway

    Thanks again, got both intellisense and build working in Visual Studio Code now.

    Documented the approach here.

    @anyhotcountry , do you also perform the flash command from VS Code? If so, how?

  • FrodeLFrodeL Norway

    Intellisense in Visual Studio Code:

  • I just use the built in terminal in VS Code and type in mos flash and other mos commands.

  • I'm getting back into MOS developments into a few months hiatus.

    I see there is a Visual Studio Code plugin, "Mongoose OS IDE", now. I've installed it.

    Are there any other tips from other Visual Studio Code users out there? Any custom settings etc that I should use?

  • Would it be possible to do debugging in Visual Studio Code with Mongoose IDE?

  • tripflextripflex Orlando, FL
    edited June 2018

    Hey guys, I actually was able to get in touch with some of the guys at Cesanta and got them to release the source code for the Visual Studio Code extension for Mongoose OS, you can find it here:

    Before they released the source code yesterday I was able to hack some of the code myself and add some features, which i will try and submit a PR for once I have some more time to do so ... but if you want to look into the source code yourself, you can find it located on your system at:


    The main JS files are located in the out directory

    If you add any RPC calls make sure to add them to the package.json file so they show up in VSCode

    When you edit the files, you must reload vscode after editing them for the changes to show up. If you're having issues with your changes, goto Help > Toggle Developer Tools and that should open a Chrome Debugger console

    Also, look at this thread for the changes I made to fix issues I was having with the debug console showing output from device:

  • tripflextripflex Orlando, FL

    I also added this to my root project directory in a file named jsconfig.json:

      "compilerOptions": {
        "target": "es6",
        "baseUrl": ".",
        "paths": {
          "*": [
      "exclude": ["dist"]

    In your user settings also make sure to set intellisense engine to Tag Parser

    "C_Cpp.intelliSenseEngine": "Tag Parser",

    I recommend doing a local build with Docker that way the deps/ directory is populated with all the libs, and then while working in mJS code you can directory goto definitions when needed

    Thanked by 1leongcy
  • Hi guys,

    Has any of you been able to build MOS apps locally within VS Code without the use of Docker but using the Espressif ESP 32 and ESP 8266 Frameworks/SDKs included in PlatformIO instead?


Sign In or Register to comment.