Export (0) Print
Expand All
Expand Minimize

Compiler Warning (level 1) C4138

'*/' found outside of comment

The closing-comment delimiter is not preceded by an opening-comment delimiter. The compiler assumes a space between the asterisk (*) and the forward slash (/).


// C4138a.cpp
// compile with: /W1
int */*comment*/ptr;   // C4138 Ambiguous first delimiter causes warning
int main()

Possible cause

  • Trying to nest comments.

Possible solution

  • To comment out sections of code that contain comments, enclose the code in an #if/#endif block and set the controlling expression to zero:
    // C4138b.cpp
    // compile with: /W1
    #if 0
    int my_variable;   /* Declaration currently not needed */
    int main()
© 2014 Microsoft