Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Token "=" is not valid in preprocessor expressions [closed]

I have a program:

#include <iostream>

#define _DEBUG = 1

using namespace std;
int main() {
        #if (_DEBUG == 1)
                cout << "hello : " <<endl;
        #endif

        return 0;
}

Compiling this gives the error:

$ g++ a.cpp
a.cpp:7:7: error: token "=" is not valid in preprocessor expressions
$ g++ --version
g++ (MacPorts gcc46 4.6.3_8) 4.6.3

I thought == is the equality conditional operator?

like image 243
highBandWidth Avatar asked Sep 24 '12 23:09

highBandWidth


1 Answers

Just a typo, I think:

#define _DEBUG = 1

should be

#define _DEBUG 1

I do that all the time!

like image 94
Mark Stevens Avatar answered Oct 13 '22 00:10

Mark Stevens