Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 implicit type conversion prevented importing the native library #214

Closed
wants to merge 1 commit into from

Conversation

BRomans
Copy link

@BRomans BRomans commented May 22, 2024

When importing the native library into Unreal Engine (not the plugin) the implicit conversion from int to bool would crash the build.
With explicit conversion the build succeeds and the functionality is preserved.

@tstenner
Copy link
Collaborator

The C++ standard mandates that integers get implicitly promoted booleans.

Could you paste the error messages you are getting without this workaround?

@BRomans
Copy link
Author

BRomans commented May 23, 2024

I thought so too but here what I get

[1/6] Compile [x64] MySystem.cpp MyProject\Plugins\lsl\Include\lsl_cpp.h(327): error C4800: Implicit conversion from 'int32_t' to bool. Possible information loss MyProject\Plugins\lsl\Include\lsl_cpp.h(327): note: consider using explicit cast or comparison to 0 to avoid this warning C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\INCLUDE\stdint.h(20): note: see declaration of 'int32_t'

It says it's a warning but it does not let me compile the Unreal Engine project I am working on.

@tstenner
Copy link
Collaborator

Did you or the build environment set "Treat warnings as errors" or the /WX flag?

@tstenner
Copy link
Collaborator

I pushed a shorter workaround that should remove the warning for MSVC.

@tstenner tstenner closed this May 23, 2024
@BRomans
Copy link
Author

BRomans commented May 24, 2024

It was all the presets of the build environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants