Error on Compile C generated files using CL.EXE


#1

Hi.

I am having problems to compile C generated files on windows.

I created a Hello World on Visual Studio Code using Haxe, Heaps, HashLink.
I can run the application (hl file) without any problems.
I can generate the C files without errors.

When I use cl.exe to compile the generated files I receive the following Error:

.\dx/Window.h(21): error C2059: syntax error: ''
.\dx/Window.h(24): error C2059: syntax error: '}'

Here is the CL command I use:

cl /Ox /Fo main /Fe main.exe -I "C:\HaxeToolkit\hashlink/include" -I "." "main.c" "C:/HaxeToolkit/hashlink/ui.lib" "C:/HaxeToolkit/hashlink/directx.lib" "C:/HaxeToolkit/hashlink/openal.lib" "C:/HaxeToolkit/hashlink/fmt.lib" "C:/HaxeToolkit/hashlink/libhl.lib"

Here is the generated file Window.h in the dx folder:

// Generated by HLC 4.0.0 (HL v5)
#ifndef INC_dx__Window
#define INC_dx__Window
typedef struct _dx__$Window *dx__$Window;
typedef struct _dx__Window *dx__Window;
#include <hl/Class.h>
#include <hl/BaseType.h>
#include <_std/String.h>
#include <hl/types/ArrayObj.h>
#include <hl/natives.h>


struct _dx__$Window {
	hl_type *$type;
hl_type* __type__;
vdynamic* __meta__;
varray* __implementedBy__;
String __name__;
vdynamic* __constructor__;
hl__types__ArrayObj windows;
int CW_USEDEFAULT;
int HIDDEN;
int RESIZABLE;
};
struct _dx__Window {
hl_type *$type;
dx_window* win;
vvirtual* savedSize;
String title;
int displayMode;
bool visible;
bool vsync;
};

#endif

Also, I tried the @Yanrishatum HLCC but it got the same compilation error.

Am I missing something?

Regards.


#2

I am also having this issue, seems to be a problem with hldx. My workaround currently is to use hlsdl instead, which works fine, but obviously not ideal. Any help with this would be appreciated.

For context I’m using Haxe 4.0.2 and Hashlink 1.10, and I’ve tried with both MSVC 2017 and 2019.


#3

You all have been hit by https://github.com/HaxeFoundation/hashlink/issues/331
Use git version until next release and admire ncannasse undefining skills. You get in the way, you get undefined.
Note: don’t forget to put sdl and openal-soft in include folder.
https://github.com/HaxeFoundation/hashlink/blob/master/libs/sdl/README.md
https://github.com/HaxeFoundation/hashlink/blob/master/libs/openal/README.md