USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.25k stars 767 forks source link

Error occurs when using Polymorphism with MSVC #795

Open kshhaja opened 1 year ago

kshhaja commented 1 year ago

Hi, all.

I'm in the process of making it possible to send and receive data from external App and UE5 using Cereal. So far it has been working without problems. Recently, I'm applying polymorphism for more efficient code. but, I got an error below in UE5(using MSVC).

traits.hpp(34): [C4668] '__GNUC__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'

To briefly describe the env of my projects: The code I wrote using Cereal is shared in both External App and UE5, and I confirmed that the build succeeded and the functions worked well in the External App. External App is using GCC.

The solution of the problem seems pretty obvious. #include "cereal/details/traits.hpp" It seems that there is only processing for GCC or CLANG at the top of this header file. In fact, when using MSVC, it seems normal to have neither GCC nor CLANG.

Please review and let me know if you find any incorrect information or solutions. Thank you.

Yeah-Zi commented 1 year ago

a compilation setting issue, adding "bEnableUndefinedIdentifierWarnings=false" in build.cs;