Sample Project notes
Closed this issue · 3 comments
Hey
I appreciate that you're mid development on a lot of this project, but I thought I'd share a few notes / questions on the Sample project
Following the README.
1) Compile Plugin's Haxe Lib
When running haxe compile.hxml
I'm getting a bunch of errors
Error: Semaphore.cpp
include\sys/thread/Semaphore.h(43): error C2039: '__hxcpp_semaphore_create': is not a member of '`global namespace''
include\sys/thread/Semaphore.h(43): error C3861: '__hxcpp_semaphore_create': identifier not found
./src/sys/thread/Semaphore.cpp(18): error C2039: '__hxcpp_semaphore_create': is not a member of '`global namespace''
./src/sys/thread/Semaphore.cpp(18): error C3861: '__hxcpp_semaphore_create': identifier not found
./src/sys/thread/Semaphore.cpp(38): error C2039: '__hxcpp_semaphore_acquire': is not a member of '`global namespace''
./src/sys/thread/Semaphore.cpp(38): error C3861: '__hxcpp_semaphore_acquire': identifier not found
./src/sys/thread/Semaphore.cpp(53): error C2039: '__hxcpp_semaphore_try_acquire': is not a member of '`global namespace''
./src/sys/thread/Semaphore.cpp(53): error C3861: '__hxcpp_semaphore_try_acquire': identifier not found
./src/sys/thread/Semaphore.cpp(61): error C2039: '__hxcpp_semaphore_release': is not a member of '`global namespace''
./src/sys/thread/Semaphore.cpp(61): error C3861: '__hxcpp_semaphore_release': identifier not found
In compile.hxml
commenting out the Test
line resolves this issue.
The Test class looks to be doing something with cppia
, it also has some references to Z:\\Desktop\..
2) Build Plugin
This step seems to run as expected, however the output does contain warning messages along the lines of:
...\Haxe-UnrealEngine5\SampleProject\Plugins\HaxeCompatibility\HostProject\Plugins\HaxeCompatibility\Source\HaxeCompatibility\hxcpp-include\Array.h(910): note: see reference to function template instantiation 'Dynamic Array_obj<ELEM_>::keyValueIterator(void)' being compiled
with
[
ELEM_=Dynamic
]
Are you getting similar warnings?
3) Compile Main Project Haxe
When running this step I get the following errors:
src/ue_helpers/Array.hx:43: characters 3-16 : ue_helpers.TArrayHX<ue_helpers.TArrayHX.T> should be Array<ue_helpers.TArrayHX.T>
src/ue_helpers/Array.hx:90: characters 3-14 : ue_helpers.TArrayHX<ue_helpers.TArrayHX.T> should be Array<ue_helpers.TArrayHX.T>
src/ue_helpers/Array.hx:128: characters 43-47 : ue_helpers.TArrayHX<ue_helpers.TArrayHX.T> should be Array<Unknown<0>>
src/ue_helpers/Array.hx:128: characters 43-47 : ... For function argument 'array'
src/ue_helpers/Array.hx:132: characters 36-40 : ue_helpers.TArrayHX<ue_helpers.TArrayHX.T> should be Array<Unknown<0>>
src/ue_helpers/Array.hx:132: characters 36-40 : ... For function argument 'array'
src/ue_helpers/Array.hx:158: characters 3-14 : ue_helpers.TArrayHX<ue_helpers.TArrayHX.T> should be Array<ue_helpers.TArrayHX.T>
src/ue_helpers/String.hx:94: characters 3-14 : ue_helpers.FStringHX should be String
src/ue_helpers/String.hx:99: characters 10-20 : String has no field AppendChar
src/ue_helpers/String.hx:24: characters 32-41 : You cannot access the cpp package while in a macro (for cpp.Int32)
If I delete src/ue_helpers/Array.hx
and src/ue_helpers/String.hx
this step compiles without errors and creates the following output:
Is it expected there is AAMyActor.h
, AMyActor.h
and MyActor.h
It is somewhat annoying that Unreal require prefixed letters at the start of Classes within the Class, however the filename is different.. how are you getting around this requirement?
Is seems like my output is slightly off.
for example I would expect the include line to omit the A
at the start and instead read: #include MyActor.generated.h
4) Open/Compile UE Project
When hitting the compile button, or running the .sln project I get the following errors which seem to be related to the prefix letters:
Haxe-UnrealEngine5/SampleProject/Source/HaxeProject/HaxeOutput/include/CustomClass.h(25): error : When compiling class definition for '', attempting to strip prefix results in an empty name. Did you leave off a prefix?
Haxe-UnrealEngine5/SampleProject/Source/HaxeProject/HaxeOutput/include/MyActor.h(25): error : When compiling class definition for '', attempting to strip prefix results in an empty name. Did you leave off a prefix?
Hello! Thank you for the thorough feedback as always. When I was committing everything to Github, I made a bunch of untested changes to help organize things better, that was my bad. I'll do some testing again and commit things so they work again right now. Be back in a bit!
Apologies for the delay! Things should work this time. I would recommend starting over as things can be a little unstable. I highly recommend deleting the Haxe/output
folder if you encounter errors since Haxe doesn't remove some of the previous output when you recompile and Unreal is super sensitive.
1) Compile Plugin's Haxe Lib
Apologies about this, I missed this when I was removing all my personal testing code. I have removed this with the recent commits and you should be able to compile it without a problem!
2) Build Plugin
Yes, I get a bunch of these warnings when compiling the plugin and when I compile the main code itself. There's a lot of problems when compiling hxcpp with Unreal because Unreal has waaaaay more errors/warnings enabled than hxcpp appears to be developed with. This has been the biggest hurdle with making this entire project work, and it was the reason I originally tried to just make my own version of hxcpp in desperate hope to get things to compile.
Fortunately, by isolating the header files, and making a couple modifications to those (now stored in Haxe/hxcpp-include
), I was able to avoid the errors that prevented things from compiling. But unfortunately there's still tons of warnings. I hope to make some contributions to hxcpp itself to remove them, or use more #pragma disable
.
3) Compile Main Project Haxe
Once again, apologies about this! The custom Array and String classes I made for Unreal with created with a previous strategy and I originally kept them in a separate folder. That's why I didn't encounter their errors. I put a bit of work into them, so I didn't want to delete them out-right when I made the new commits, so I just threw them in without thinking. The new commits should make them compile without problems now. 👌
As for the naming issues, I'm not entirely sure where those stem from. They appear to work fine for me? I recommend compiling this project again with just the sample MyActor.hx
class I've provided and get that working first without changing anything. From there, be sure to follow the naming conventions when creating a new class (in Haxe, you don't need to add the prefixes to the classes, the macros do it for you automatically). If you continue to have issues, make another issue and I'll be more than happy to fix it! :)
4) Open/Compile UE Project
Read the above. I think this should be fixed if you follow the same steps again with the new commits. But if not let me know!
Hi there
Thanks for the fast response and honestly there absolutely no need to be apologizing.
Looks like all the above points are resolved, the sample project compiles and can be run through Unreal.
There does appear to be an issue with function that use @:ufunc
. eg:
@:ufunc()
public function BlueprintFunc() {
trace("This function can be called from blueprints.");
}
but it seems like there is a pretty simple fix for it.. (I've submitted a pull request)