title: Macros Expected an Expression
body: <p>I'm currently working on a school project and the requirements for part of the assignment I am working on looks like this:</p>
  
  <blockquote>
    <p>The error state which the client can reference to determine if the
    object holds a valid date, and if not, which part of the date is in
    error. The possible error states are integer values defined as macros
    in the Date class header:</p>
  </blockquote>
  
  <pre><code>NO_ERROR   0  -- No error - the date is valid
  CIN_FAILED 1  -- istream failed on information entry
  YEAR_ERROR 2  -- Year value is invalid
  MON_ERROR  3  -- Month value is invalid
  DAY_ERROR  4  -- Day value is invalid"
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>void errCode(int errorCode);
  </code></pre>
  
  <blockquote>
    <p>This function sets the error state variable to one of the values listed above.</p>
  </blockquote>
  
  <p>However when I put my code into the second function visual studio gives me a red underline and states "expected an expression" when I try to use the macro values in an if statement.</p>
  
  <pre><code>// this code is unfinished and partial
  
  void Date::errCode(int errorCode)
  {
      if (errorCode == NO_ERROR) // &lt;- red underline here
      {
          m_errorState = NO_ERROR; // &lt;- red underline here
      }
      if (errorCode == 1)
      {
      }
  }
  </code></pre>
  
  <p>The header file defines look like this:</p>
  
  <pre><code>#define NO_ERROR = 0        // No error - the date is valid
  #define CIN_FAILED = 1      // istream failed on information entry
  #define YEAR_ERROR = 2      // Year value is invalid
  #define MON_ERROR = 3       // Month value is invalid
  #define DAY_ERROR = 4       // Day value is invalid
  </code></pre>