Compiling to exe from c

I’m trying to compile my game to an exe. I’m using:

gcc -O3 -o main -std=c11 -I out out/main.c -lhl -llibhl -lopenal -lui -lfmt -lsdl -Llibs -I hashlinkSRC

But it fails with:

c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\spenl\AppData\Local\Temp\ccCEbd6d.o:main.c:(.text+0x4f7a6): undefined reference to `__imp_SymFromAddrW'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\spenl\AppData\Local\Temp\ccCEbd6d.o:main.c:(.text+0x4f7ee): undefined reference to `__imp_SymGetLineFromAddrW64' 
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\spenl\AppData\Local\Temp\ccCEbd6d.o:main.c:(.text+0x4f854): undefined reference to `__imp_SymSetOptions'
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\spenl\AppData\Local\Temp\ccCEbd6d.o:main.c:(.text+0x4f869): undefined reference to `__imp_SymInitialize'

Anyone know how to fix this? I’m compiling from windows.

I was able to fix and compile by adding dbghelp.dll to my libs folder and adding -ldbghelp.
BUT,

When I run the game the terminal pops up and says:
image

I’m kinda thinking this has something to do with my assets. Are they included in the build by default or do I need to do something to include them?

It’s sometimes hard to fix these errors, because it’s unclear where they come from and there are so many layers and interfaces (haxe>hashlink>C>GCC>exe). But at least I can tell me too I’m working with GCC and x86_64-w64-mingw32 and I’m pretty sure other developers do as well, e.g. in the discord channel.

In a post before I tried to collect some different approaches and experiences about compiling to .exe/Windows. In my case I had no trouble with including some simple .png-assets, however it’s true there are many different things that have to be included (e.g. like you said --exFile C:\Windows\System32\dbghelp.dll) for the compiling to work. And for now they need to be taken care of by hand.

Future?

Maybe someone should/will make some tiny UI app to help that. (I mean we’re still open source here so … we’re “cowboys in the wild” :cowboy_hat_face: )

It’s cool…I’ll continue to fiddle with compiling to exe as I work on the game. I’m sure it’s “possible” lol

About the resources (I’m new to haxe and heaps)… is this .hxml flag required for all my assets?

?

I don’t know how to compile exe from c, but i know a tool that compiles hashlink as an exe.

The tool is called redistHelper

1 Like