We recommend using Visual Studio 2017

Compiler Error C2015


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2015.

too many characters in constant

A character constant contains more than two characters. The limit is one character for standard character constants and two characters for long character constants.

An escape sequence, such as \t, is converted to a single character.

The following sample generates C2015:

// C2015.cpp  
// compile with: /c  
char test1 = 'error';   // C2015  
char test2 = 'e';   // OK  

C2015 can also occur when using a Microsoft extension, character constants converted to integers. The following sample generates C2015:

// C2015b.cpp  
#include <stdio.h>  
int main()   
    int a = 'abcde';   // C2015  
    int b = 'a';   // 'a' = ascii 0x61  
    printf_s("%x\n", b);