ERROR for build package with plugin DirectExcel on UE4.27.2 source oculus branch

Hello, I have a project for Oculus Quest 2 with DirectExcel plugin that works as I want in UE 4.27.2.

In order to take advantage of all the Quest 2 optimizations, I wanted to try my project in the Oculus branch of UE 4.27.2. So I compiled from the source, then foolishly tried to copy the plugin into the new UE “oculus”. It did not work, I then regenerated the engine files via the .bat and recompile UE, it worked I could open the project and test in preview on the PC works, the plugin also (it just create an excel with statistics.

Now I have an " Error: loop variable ‘h’ of type ‘const std::pair<std::string, zheader>" message when I try to build the project in APK for the Quest 2:

FullBuild.log (2.5 MB)

UATHelper: Packaging (Android (ASTC)): [319/724] Module.DirectExcel.4_of_4.cpp [arm64]
UATHelper: Packaging (Android (ASTC)): In file included from S:/Unreal/MayaCampus/Sigvaris/ProjetSigvarisV1/Intermediate/Build/Android/ProjetSigvaris/Shipping/DirectExcel/Module.DirectExcel.4_of_4.cpp:3:
UATHelper: Packaging (Android (ASTC)): S:/Program Files/Epic Games/UE4.27_oculus/Engine/Plugins/Marketplace/DirectExcel/Source/DirectExcel/xlnt/detail/serialization/zstream.cpp(624,49): error: loop variable ‘h’ of type ‘const std::pair<std::string, zheader> &’ (aka ‘const pair<basic_string, xlnt::detail::zheader> &’) binds to a temporary constructe
d from type 'std::__hash_map_const_iterator<std::__hash_const_iterator<std::__hash_node<std::hash_value_type<std::basic_string, xlnt::detail::zheader>, void *> *>>::reference’ (aka ‘const pair<const std::basic_string, xlnt::detail::zheader> &’) [-Werror,-Wrange-loop-construct]
UATHelper: Packaging (Android (ASTC)): for (const std::pair<std::string, zheader>& h:file_headers
)
UATHelper: Packaging (Android (ASTC)): ^
UATHelper: Packaging (Android (ASTC)): S:/Program Files/Epic Games/UE4.27_oculus/Engine/Plugins/Marketplace/DirectExcel/Source/DirectExcel/xlnt/detail/serialization/zstream.cpp(624,10): note: use non-reference type ‘std::pair<std::string, zheader>’ (aka ‘pair<basic_string, xlnt::detail::zheader>’) to make construction explicit or type 'const std::

_hash_map_const_iterator<std::__hash_const_iterator<std::__hash_node<std::_hash_value_type<std::basic_string, xlnt::detail::zheader>, void *> *>>::value_type &’ (aka ‘const pair<const std::basic_string, xlnt::detail::zheader> &’) to prevent copying
UATHelper: Packaging (Android (ASTC)): for (const std::pair<std::string, zheader>& h:file_headers
)
UATHelper: Packaging (Android (ASTC)): ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UATHelper: Packaging (Android (ASTC)): 1 error generated.
PackagingResults: Error: loop variable ‘h’ of type ‘const std::pair<std::string, zheader> &’ (aka ‘const pair<basic_string, xlnt::detail::zheader> &’) binds to a temporary constructed from type ‘std::__hash_map_const_iterator<std::__hash_const_iterator<std::__hash_node<std::__hash_value_type<std::basic_string, xlnt::detail::zheader>, void *> *>>:
:reference’ (aka ‘const pair<const std::basic_string, xlnt::detail::zheader> &’) [-Werror,-Wrange-loop-construct]

I don’t know how to solve this ? Any ideas?
Was my method to include the plugin the right one?

Thanks in advance
( sorry for my english I use a translator ^^ )

the error signal the for loop here:

std::vector izstream::files() const
{
std::vector filenames;

for (const std::pair<std::string, zheader>& h:file_headers_)
{
filenames.push_back(path(h.first));
}

return filenames;

}

I commented the for loop, to bypass the error because it is a function that is not called in my case (for zip file).

I don’t have the error anymore, but still no compilation, maybe finally it’s because of this other error which often comes back as “warning” and then as error :

UATHelper: Packaging (Android (ASTC)): (2,9): error: ‘ANDROID_API’ macro redefined [-Werror,-Wmacro-redefined]

1 Like

Hey @BenJ3D,
This could be a compatibility issue if the plugin does not support that specific version of Unreal - attempting to merge the two is probably what created the errors.
You may need to try a new engine version thats compatible or reach out to the creators on the status of the errors.
I hope this can help!
-Zen

Thank you for your answer.

So in the end it was a configuration problem. I installed another version of NDK in Android Studio, version 21.4.7075529 instead of 23.0.7599858 (which was working fine until then ^^), I pointed Unreal to this new NDK version in “Android SDK” settings, and then I could compile the apk with the plugin :slight_smile: .