Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Problem with enum and binary or operator

$
0
0
Why wont this code compile? How do i get this to compile (VC++ 2015)? typedef enum fpl_InitFlag { fpl_InitFlag_None = 0, fpl_InitFlag_Window = 1 << 0, fpl_InitFlag_VideoOpenGL = 1 << 1, } fpl_InitFlag; static void InitSomething(fpl_InitFlag initFlags) { if (initFlags & fpl_InitFlag_VideoOpenGL) { initFlags |= fpl_InitFlag_Window; } } int main(int argc, char **args) { InitSomething(fpl_InitFlag_VideoOpenGL); return 0; } Error C2676 binary '|=': 'fpl_InitFlag' does not define this operator or a conversion to a type acceptable to the predefined operator Error (active) this operation on an enumerated type requires an applicable user-defined operator function

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>