HaxeFoundation / HaxeFoundation/hxcpp

hxcpp-generated header files can interfere with system header files

Open
#316 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

_Steps to reproduce:_
1) Have a haxe file in your project called `WChar.hx`.
2) Compile targetting C++ on a Windows build machine.

Result:

```
Error: In file included from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/hxcpp.h:40,
from ./src/WChar.cpp:1:
include/wchar.h:8: error: expected constructor, destructor, or type conversion before '(' token
In file included from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h:60,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h:61,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h:63,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm:62,
from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/Array.h:283,
from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/hxcpp.h:262,
from ./src/WChar.cpp:1:
C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new:42: error: expected declaration before end of line
Error: In file included from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/hxcpp.h:40,
from ./src/Main.cpp:1:
include/wchar.h:8: error: expected constructor, destructor, or type conversion before '(' token
In file included from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_construct.h:60,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_tempbuf.h:61,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/bits/stl_algo.h:63,
from C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/algorithm:62,
from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/Array.h:283,
from C:/HaxeToolkit/haxe/lib/hxcpp/3,2,102/include/hxcpp.h:262,
from ./src/Main.cpp:1:
C:\Development\Android NDK/sources/cxx-stl/gnu-libstdc++/4.4.3/include/new:42: error: expected declaration before end of line
```

The hxcpp-generated cpp file is including `hxcpp.h` which is including normal C header files which are including `wchar.h`. Windows doesn't have case-sensitive filenames and the build system finds the hxcpp-generated `WChar.h` before the system header file `wchar.h`. This leads to a very unhelpful error message.

There are many other filenames which would cause this problem: I originally encountered it with `signal.h`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.