Skip to content

GCC Errors on Windows

FAL edited this page Jun 16, 2020 · 4 revisions

Not directly related to hlc-compiler, but here some info.

Sometimes you might face errors like below when you run gcc command.

undefined reference to `__imp_SymSetOptions'
undefined reference to `__imp_SymInitialize'
undefined reference to `__imp_SymFromAddrW'
undefined reference to `__imp_SymGetLineFromAddrW64'

These might be resolved by linking (i.e. adding to --exFiles option of hlc-compiler) dbghelp.dll or dbghelp.lib.

WinMain errors (HashLink 1.11 or prior)

Sometimes you might face undefined reference to 'WinMain' errors when you run gcc command.

This might be resolved by editing hlc_main.c, for example inserting something like the below:

#ifndef _CONSOLE
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
	#ifdef HL_WIN_DESKTOP
	return wmain(__argc, __argv);
	#else
	return main(__argc, __argv);
	#endif
}
#endif

cf. https://community.heaps.io/t/how-to-compile-c-files-generated-by-hashlink/74/12

[edit] Added in the recent HashLink repository. See:
https://github.com/HaxeFoundation/hashlink/commit/f5e7b4ffb50bcad13945cc536ee049b38ee8d771

Clone this wiki locally