Skip to main content
Version: Next

Preprocessor

The preprocessor edits files before they go to the LIGO compiler.

The JsLIGO compiler no longer supports preprocessor directives.

  • Instead of using the #include or #import directives, import namespaces in other files directly with the import keyword as described in Importing and using classes or Importing namespaces.

  • The #if, #else, #elif, #endif, #define, #undef, and #error directives are no longer supported. If you need to continue using them, you can run your JsLIGO code through a C++ preprocessor, which uses the same syntax. JsLIGO code with these directives does not compile.

Viewing the preprocessor output

It's rarely necessary to view the output of the preprocessor, but if you need to see the output to debug directives, you can view the output with the ligo print preprocessed command, as in this example:

ligo print preprocessed myContract.jsligo