RSS
Follow Us
Contribute
 
 
 
 

Error C2015: too many characters in constant

 
We need YOUR SKILLS in this collaborative work, to build the largest solution center for error messages.

From $1

Table of contents
  1. 1. Cause
  2. 2. Solution

Cause

This error message appears in Visual C++ when more than 4 characters are assigned to a character variable. Ex:

char a = 'abcde';

Solution

It is always better to prefer constants with only one character if you are dealing with character variables.

char a = 'a';

If you want to use constants with more than characters, you would choose strings instead of character variables.

string a = "abcde";
 
 
 
 
Comments