Issues with externs and HXCPP with 3.3 and latest hxcpp

114 views
Skip to first unread message

Mikkel Munck Rasmussen

unread,
Aug 22, 2016, 8:50:55 AM8/22/16
to Haxe
Hi there 

I'm playing around with Haxe 3.3rc1 and latest HXCPP just to be one step ahead, when next Haxe is released.

I have some Haxe externs for CPP code that used to work with Haxe 3.2.1 and HXCPP 3.2.205, however when switching to latest Haxe 3.3 and HXCPP 3.3.49 I get a lot of errors like:

"fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "hxcpp.h"' to your source?"

Am I supposed to do something different in the new releases when it comes to HXCPP externs?

/Mikkel

Hugh

unread,
Aug 23, 2016, 12:38:57 AM8/23/16
to Haxe
haxe 3.3 is now more particular about using precompiled headers to speed up compilation, which is generally a good thing.
However, there are a few rules with precompiled headers, particularly that the include order needs to match.
This in turn means that the first real line in your source file needs to be "#include <hxcpp.h>"

So if you are including this file, but not at the top, just move it to the top.
If you are not including it directly (maybe indirectly?) then you could consider adding it just as a simple fix.
If you do not want to include this at all, you can either:
  1. move your external cpp  to a separate "file group" in the build.xml (not the haxe one)
  2. I might be able to come up with some class meta to disable precompiled headers for this one file
  3. As a last resort, disable precompiled headers with NO_PRECOMPILED_HEADERS, either as a define or in .hxcpp config.

You can get a nice speed improvement with PCH, so try to avoid 3.
If the simple fixes are not acceptable, I can give more info about 1 ot 2.

Hugh

Mikkel Munck Rasmussen

unread,
Aug 23, 2016, 9:33:37 AM8/23/16
to Haxe
Thanks a lot Hugh, very good explanation.

Option 1 solved my problem. 

There was a file group with id "__externs__" that seemed like the logical place to put it (although I don't know if that could cause any unwanted side effects, but it seems to work).

Mikkel

Hugh

unread,
Aug 24, 2016, 12:21:14 AM8/24/16
to Haxe
I had actually forgotten about that one, but that is a good place for it.
Reply all
Reply to author
Forward
0 new messages