Skip to content

Instantly share code, notes, and snippets.

@kvk1920
Last active July 11, 2021 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvk1920/57e1851d106bed86ded8c3232895744c to your computer and use it in GitHub Desktop.
Save kvk1920/57e1851d106bed86ded8c3232895744c to your computer and use it in GitHub Desktop.
  1. First of all you need either Clang64 or MinGW64 MSYS2 environment
  2. You will probably need to install llvm and cmake: pacman -S install llvm cmake
  3. c3c: https://github.com/kvk1920/c3c
git clone https://github.com/kvk1920/c3c c3c_win_test
cd c3c_win_test
git checkout windows_compatibility
mkdir cmake-build
cd cmake-build
cmake .. -G "MinGW Makefiles"
cmake --build .
  1. After that create file main.c3 with the following content:
module hello_world;
import std::io;

func void main()
{
   io::printf("Hello, world!\n");
}
  1. ./c3c.exe compile main3.c --target x64_mingw - this fails with some linker errors, but object file hello_world.o should be created.
  2. Now you can just run clang hello_world.o to link against necessary system libs and startup files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment