Fatal error C1017: invalid integer constant expression

I have an instruction in my code:

#if DEBUG == 0

this works fine in gnu g ++, but in VC ++ it doesn't work. Can someone explain what is wrong with this.

I already read the msdn help on this topic. therefore, if debug is defined as 1, then it is false ie0, so it should work similarly if debug = 0

Can anyone suggest how to fix this. My code must be compiled on both Linux and win.

thank

+3
source share
1 answer

Leave it as:

#if DEBUG

Although I have to add that usually one checks if DEBUG is defined, and not if it is 1. To declare, you simply say:

#define DEBUG

Check if this is defined:

#ifndef DEBUG
0

Source: https://habr.com/ru/post/1771910/


All Articles