sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
114 stars 67 forks source link

:bug: implicit type conversion prevented importing the native library #214

Closed BRomans closed 4 months ago

BRomans commented 4 months ago

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 commented 4 months ago

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

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

BRomans commented 4 months ago

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 commented 4 months ago

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

tstenner commented 4 months ago

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

BRomans commented 4 months ago

It was all the presets of the build environment