Click here to Skip to main content
14,768,257 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
const Timer1 = 1;
const Timer2 = 2;
const ID_TOOLTIP = 1;

Run by Vc++ these type of error occur how to solved this kind of problem ....
Updated 30-Apr-14 4:16am
[no name] 30-Apr-14 7:12am
Try supplying a type specifier.
Richard MacCutchan 30-Apr-14 9:16am
What data type are all those const values?

You must specify a type (or, by a rather modern compiler, you are allowed to use the auto[^] specifier), e.g.
const int Timer1 = 1;

const auto Timer1 = 1;
I am going to extend the answer you trying to do 1 of 2 things

1.) Just provide a static constant number which you rarely if ever gets changed and you are giving it a name so it reads well and you can stop typing the number or change it globally if required.

Assuming that you use #define in C/C++
#define Timer1 1
#define Timer2 2
#define ID_TOOLTIP 1

Not this gets interpreted by the compiler as a straight text substitute anywhere it sees the initial statement it substitutes the second and then it actually runs the compilation. The actual value does not exist anywhere in memory in the final code and you note it has no line ending ";" statement because it is a text substitution.

2.) Provide something that physically exists in memory address but is constant.
If you have something like a table that is going to be used over and over then making it a constant in memory makes sense.

Assuming that you use the form
const <type> <label>=<value>;

So it looks like
const int Timer1=1;   
const int Timer2=2;
const long ID_TOOLTIP=1;

Due to the ID_TOOLTIP I suspect you want number 1 form above because tooltip, buttonid,child window id's tend to be just #defined
Member 10718181 30-Apr-14 9:43am
Thank u very much
You are declaring 3 variables without telling the compiler what their type is...
Try this (or any other type suits your application):
const int Timer1 = 1;
const int Timer2 = 2;
const int ID_TOOLTIP = 1;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900