|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming | |
What does "Undeclared Identifier" mean?
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) | |||||||||||||
|
PC Gamer
|
I keep getting this error in Visual Studios 05 when i try to edit SodaDMTGuys speed converter, I am trying to change it to a length (english/metric converter) and if i edit the line:
cin >> c2d; cout << "Comparable AMD Athlon (64/X2/FX) speed is: " << c2d * 1.3333333333333333333333 << endl; to: cin >> mile; cout << "Comparable AMD Athlon (64/X2/FX) speed is: " << mile * 1.3333333333333333333333 << endl; It says that Mile is an undeclared identifier so what do i do to it?
|
|||||||||||||
|
|
|
|
#2 (permalink) | ||||||||||||
|
Programmer
|
Quote:
You probably didn't initialize mile, ie before you can store whatever input the user enters in the variable mile you have to tell the computer your using it. Something like float mile; or double mile; unless you did that?
|
||||||||||||
|
|
|
|
|
#3 (permalink) | ||||||||||||||
|
Photography nut
![]() |
Some where theres probaby a line that says
int c2d; or double c2d; you just need to change that or add int mile; or double mile; The error message means you never declared what type of scalar mile is. I don't think its an initialization problems since it says unknown identifier, I think he just never declared "mile" before he tried to use it.
__________________
"UNIX was never designed to keep people from doing stupid things, because that policy would also keep them from doing clever things." - Doug Gwyn Try out the latest Programming Challenge Quote:
CPU-Z Validation @ 2.97-prime95 stable 16 hours @ 1.48v Proof | CPU-Z Validation @ 3.15 Getting Mouse Side Buttons to work in Linux, Compile a custom Kernel, More
Last edited by dangerousHobo : 09-22-07 at 11:29 PM. |
||||||||||||||
|
|
|
|
#4 (permalink) | |||||||||||||
|
PC Gamer
|
no, I just edited the compiled program, so i figured it would work if I just changed the variables/words, ill try doing what you said
EDIT: ^Gotcha
|
|||||||||||||
|
|
|
|
#5 (permalink) | |||||||||||
|
Programmer
|
yea you can't jsut edit single parts, if you change a variable name in one place you have to search the entire program to change all isntances of it. The program needs to know what kind of variable it is so it can allocate the right space for it and so it knows what 'things' you can do to it and what you can't.
__________________
|
|||||||||||
|
|
|
|
|
#6 (permalink) | |||||||||||||
|
PC Gamer
|
Alright I will look for all instances of it
EDIT: DUH forgot to change the beginning variables EDIT: what does this mean: c:\documents and settings\user\my documents\visual studio 2005\projects\speed coverter\speed coverter\file.cpp(52) : error C2563: mismatch in formal parameter list c:\documents and settings\user\my documents\visual studio 2005\projects\speed coverter\speed coverter\file.cpp(52) : error C2568: '<<' : unable to resolve function overload c:\program files\microsoft visual studio 8\vc\include\ostream(971): could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' with [ _Elem=wchar_t, _Traits=std::char_traits<wchar_t> ] c:\program files\microsoft visual studio 8\vc\include\ostream(963): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' with [ _Elem=char, _Traits=std::char_traits<char> ] c:\program files\microsoft visual studio 8\vc\include\ostream(937): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' c:\documents and settings\user\my documents\visual studio 2005\projects\speed coverter\speed coverter\file.cpp(64) : error C2563: mismatch in formal parameter list c:\documents and settings\user\my documents\visual studio 2005\projects\speed coverter\speed coverter\file.cpp(64) : error C2568: '<<' : unable to resolve function overload c:\program files\microsoft visual studio 8\vc\include\ostream(971): could be 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' with [ _Elem=wchar_t, _Traits=std::char_traits<wchar_t> ] c:\program files\microsoft visual studio 8\vc\include\ostream(963): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' with [ _Elem=char, _Traits=std::char_traits<char> ] c:\program files\microsoft visual studio 8\vc\include\ostream(937): or 'std::basic_ostream<_Elem,_Traits> &std::endl(std::basic_ostream<_Elem,_Traits> &)' Build log was saved at "file://c:\Documents and Settings\User\My Documents\Visual Studio 2005\Projects\speed coverter\speed coverter\Debug\BuildLog.htm"
Last edited by coltsrock : 09-22-07 at 11:47 PM. |
|||||||||||||
|
|
|
|
#7 (permalink) | |||||||||||||
|
PC Gamer
|
any ideas guys? I Tried changing th beginning variables, and every instance and got that^ error
|
|||||||||||||
|
|
|
|
#8 (permalink) | |||||||||||||
|
Programmer
|
eesh, those are some strange error messages, it'd be easier if you posted up your code so we could see what was happening. You don't even need to replace c2d with mile in every case, as long as you declare mile.
Code:
double mile; cin >> mile; cout << "Comparable AMD Athlon (64/X2/FX) speed is: " << mile * 1.3333333333333333333333 << endl; #include <iostream> at the top of your file?
__________________
Whats this folding I've been hearing about? Crucial Ballistix Club ![]() Member of the OCN Diablo III Club ~M Hail to the Victors M~
|
|||||||||||||
|
|
|
|
#9 (permalink) | |||||||||||||
|
PC Gamer
|
well i got it to work, i think it was that i was using commas to write 5280 so now its fine
|
|||||||||||||
|
|
|
|
#10 (permalink) | |||||||||||||
|
Born to ROCK!
|
You didn't declare mile.
__________________
..::The_Rocker's Hardware History::..
Q6600 B3 @ 3.2 | Q6600 B3 @ 3.6 | Q6700 G0 @ 3.6 | E8600 @ 4.33 ASUS P5N32-E SLI 680i | eVGA 680i A1 | eVGA 780i A1 XFX 7600GT XXX | BFG 8800GTX OC2 | PoV 8800GTS 512 | SLI Gainward 8800GTX's | SLI eVGA 9800GTX SC's SLI Zotac GTX280 AMP's | SLI XFX GTX280's ..::Coming Soon::.. Intel QX9650 Quad Extreme (Arrived) eVGA 790i FTW 2 x 2GB G.Skill HZ 1600Mhz DDR3
|
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|