Open utterances-bot opened 4 years ago
On linux, I had to use:
gcc -o main out/main.c -Iout /usr/local/lib/*.hdll -lhl -lSDL2 -lm -lopenal -lGL
-Iout
adds the out
directory to the linker so it can find all the other files in there.
/usr/local/lib/*.hdll
is where all the hdll files are kept because I built and installed hashlink from source.
The remaining arguments load various libraries necessary to make the native executable.
I found this info here: https://github.com/HaxeFoundation/hashlink/issues/124
The VS part -D hlgen.makefile=vs2019
didn't work for me.
@amrezzd For now vs2019 was removed temporarily (due to performance issues), vs2015 or vs2017 are still available.
Trying to run haxe --main Main --hl out/main.c -D hlgen.makefile=vs2017
but no solution file is generated. I only have the 2017 build tools do I need the full install for 2017?
Make sure you have an up-to-date version of the hashlink
helper library. As mentioned here, You can install an up-to-date version using:
haxelib git hashlink https://github.com/HaxeFoundation/hashlink.git master other/haxelib/
I think the build tools should be enough.
I can't get the VS part of compilation, i have both VS2019 and VS2017 and when building with -D hlgen.makefile=vs2017
it returns Code generated in out/main.c automatic native compilation not yet implemented
and missing hlc_main.c?
The message Code generated in out/main.c automatic native compilation not yet implemented
is normal, it is referring to the fact that, as of now, the code generated does not automatically get compiled for you, even if you create a Visual Studio project to make it easier to do manually.
In the output directory (out/
) there should be a main.vxproj
file which you should open and build. I assume this stage is where you are experiencing the hlc_main.c
error. It seems like there is a problem with the HASHLINK
environment variable. Did you make sure to set it?
First, the HASHLINK environment variable must be set up, pointing to the Hashlink install location. This is necessary as it is used within the project files to locate the Hashlink sources.
Make sure that it has been set, and then restart Visual Studio (and any terminals you are building from).
Still unavaliable to generate vs project. Just provide precompiled libraries for gcc on windows please, everything will be simple!
Here is a method to direct compile with msvc's cl.exe:
haxe --main Main --hl=out/main.c
cd out
set hashlink=C:\HaxeToolkit\hashlink
cl.exe /Ox /Fe -I "%hashlink%\include" -I "." "main.c" "%hashlink%\ssl.lib" "%hashlink%\directx.lib" "%hashlink%\openal.lib" "%hashlink%\fmt.lib" "%hashlink%\libhl.lib"
HashLink/C Compilation - Haxe - The Cross-platform Toolkit
Haxe is an open source toolkit based on a modern, high level, strictly typed programming language.
https://haxe.org/manual/target-hl-c-compilation.html