Jan 24, 2011 at 2:46pm UTC
the problem is the variable "code" is declared in other class ???
void
eWindow ::Wconnect()
{
// create textinput
mytext=new eTextInputField(this);
// give position
mytext->move(ePoint(160, 70));
// give size
mytext->resize(eSize(130, 40));
// set max number of characters
mytext->setMaxChars(13);
mytext->setUseableChars("1234567890");
//mytext->setText(codeentry);
// show a frame decoration
mytext->loadDeco();
//set focus to textinput
setFocus(mytext);
}
void
Fetcher ::fetch()
{
// declare variable
eString url, code;
code = mytext->getText();
// assign to the variable the url we want to connect
url = "
http://www.hoste.com/activate.php/?activate="+ code ;
}
this is error mesage
1 2 3 4
Active.cpp: In member function `void Fetcher::fetch()':
Active.cpp:180: error: `code' undeclared (first use this function)
Active.cpp:180: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [Active.o] Erreur 1
Last edited on Jan 24, 2011 at 2:49pm UTC
Jan 24, 2011 at 3:17pm UTC
Just a shot in the dark but change eString url, code;
to eString url, MyCode;
P.S: Don't bump your threads, it won't get you help any faster.
Last edited on Jan 24, 2011 at 3:19pm UTC
Jan 24, 2011 at 3:19pm UTC
code clearly appears to be declared at the start of void Fetcher::fetch()
How sure are you that the code you've shown above is the same code that's being compiled?
Jan 24, 2011 at 3:22pm UTC
His first sentence I think says it all, "code" is being used as a global variable in one of the headers or libs he is linking to.
Last edited on Jan 24, 2011 at 3:22pm UTC
Jan 24, 2011 at 3:23pm UTC
If that's the case, wouldn't a redeclaration of code within a scope simply shadow the global one, rather than causing the compiler to state that it isn't declared anywhere?
Jan 24, 2011 at 3:28pm UTC
I thought if it was constant it couldn't be overshadowed like that. I'm not one to use global variables unless their vectors.
EDIT: Either constant or static or one of those.
Last edited on Jan 24, 2011 at 3:29pm UTC
Jan 24, 2011 at 3:46pm UTC
i cant understand ....
the probleme is /
*mytext is declared in eWindow class
code = mytext ->getText();
"mytext" is in declared deferent class and when i call "code" = error because code use a variable "mytext" declared in other class
what i should do to correct the bug ??
Last edited on Jan 24, 2011 at 3:53pm UTC
Jan 24, 2011 at 3:52pm UTC
Privatize your variables? Don't name them all the same thing? There are a few solutions if I'm understanding you correctly.
Jan 24, 2011 at 4:00pm UTC
please ..
code = mytext->getText();
'code' is declared in ( void Fetcher::fetch() ).
'mytext' is declared in ( void eWindow::Wconnect() )
there is mean the two variable is declared in defferente class
so when i need execute "code" = error because "code" cant get 'mytext' value because it in other class ??
so how i can correct this.....
i am begenner in c++ so please correct me in the programme
Jan 24, 2011 at 4:04pm UTC
They are declared LOCALLY to that member function, are you trying to use them outside of that scope? Say in a different function?
Jan 24, 2011 at 4:05pm UTC
Uh. I don't think so, Computergeek.
Active.cpp: In member function `void Fetcher::fetch() ':
Active.cpp:180: error: `code' undeclared (first use this function)
Although maybe there's more than one Fetcher class, and we just haven't gotten to the redefinition errors yet.
-Albatross
Last edited on Jan 24, 2011 at 4:06pm UTC
Jan 24, 2011 at 4:15pm UTC
the problem is how can call member declared in other class ??
Jan 24, 2011 at 4:16pm UTC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
void Fetcher::fetch(eString code)
{
// declare variable
eString url;
url = "http://www.hoste.com/activate.php/?activate=" +code;
}
//...Somewhere else;
Fetcher fetcher;
fetcher.fetch(mytext->getText() );
//...
Last edited on Jan 24, 2011 at 4:20pm UTC
Jan 24, 2011 at 4:17pm UTC
Ah, I see. My bad.
Can we have the eString, Fetcher and eWindow class definitions? With the associated member functions?
EDIT: Ok Grey Wolf, you seem to know what's going on. Just curious but what library was this?
Last edited on Jan 24, 2011 at 4:19pm UTC
Jan 24, 2011 at 4:22pm UTC
Ok Grey Wolf, you seem to know what's going on. Just curious but what library was this?
Got
know no idea, but it seems the most logical way to get the code into Fetcher.
It is all pure guess work without further details.
Last edited on Jan 24, 2011 at 4:30pm UTC
Jan 24, 2011 at 4:24pm UTC
dont work Mr Grey ...
code is declared in other Void
Jan 24, 2011 at 4:26pm UTC
@ zeos: It can't be declared in another void. My next guess would be that "code" is a member of the Fetcher class and you are trying to redeclare it. Have you tried renaming it locally like I suggested?
EDIT: Well it CAN be declared in another void but it shouldn't matter if it is.
Last edited on Jan 24, 2011 at 4:26pm UTC
Jan 24, 2011 at 4:28pm UTC
Try giving more information, the full error text, more code, what you are trying to do...