c2lang / c2compiler

the c2 programming language
c2lang.org
Apache License 2.0
704 stars 49 forks source link

How do I build my executable? #110

Closed phillvancejr closed 4 years ago

phillvancejr commented 4 years ago

Hello all, just trying out C2. I have a simple file but running c2c doesn't seem to produce a binary

module add_five;

import stdio;

public func i32 main()
{
      stdio.printf("testing\n");
      return 0;
}

recipe.txt

executable add_five
      add_five.c2
end

running c2c in the same directory as add_five.c2 and recipe.txt outputs: building target add_five

but no binary is produced. Is it being output somewhere else? Did I write the recipe file wrong? any help would be appreciated

thank you

bvdberg commented 4 years ago

C2C has 2 backends (C-generator and IR-generator). By default none is enabled. So change your recipe into:

executable add_five
    $generate-c single-module
    add_five.c2
end

The output will be in the output directory

Your question also made me realize how unusual the current behavior is. I'll change this so the default behavior to use the C-generator. Thx!