Raffoman
Raffoman

Reputation: 33

Unable to find numeric literal operator ‘operator""

I'm trying to create an array with inside: 1_0R 1_5R 2_0R

char height[] = { 1_0R , 1_5R , 2_0R };

because I'm working with i/o files, and the string mentioned are inside the filenames. I use

+to_string( height[1] )+

When I compile I get the 3 errors

 **error: unable to find numeric literal operator ‘operator""_0R’**
 **error: unable to find numeric literal operator ‘operator""_5R’**
 **error: unable to find numeric literal operator ‘operator""_0R’**

What can I do?

Upvotes: 2

Views: 13020

Answers (1)

Oussama Ben Ghorbel
Oussama Ben Ghorbel

Reputation: 2119

You cannot name variables using digits at the beginning.

Those variables are not accepted by C++ naming variable criteria.

I guess you mean the following

char *height[] = {"1_0R","1_5R","2_0R"}

Upvotes: 3

Related Questions