Compiler Warning (level 1) C4067

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

unexpected tokens following preprocessor directive - expected a newline

The compiler found and ignored extra characters following a preprocessor directive. This warning appears only under ANSI compatibility (/Za).

// C4067a.cpp  
// compile with: /DX /Za /W1  
#pragma warning(default:4067)  
#if defined(X)  
#else  
#endif v   // C4067  
int main()  
{  
}  

To resolve this warning, try the following:

  1. Compile with /Ze.

  2. Use comment delimiters:

// C4067b.cpp  
// compile with: /DX /Za /W1  
#if defined(X)  
#else  
#endif  
int main()  
{  
}  

Show: