what the wrong in this .....!!!!

Pages: 12
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
waiting help thanks...
waiting help thanks...
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
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?
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
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?
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
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
Privatize your variables? Don't name them all the same thing? There are a few solutions if I'm understanding you correctly.
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
They are declared LOCALLY to that member function, are you trying to use them outside of that scope? Say in a different function?
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
the problem is how can call member declared in other class ??
closed account (z05DSL3A)
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
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
closed account (z05DSL3A)
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
dont work Mr Grey ...

code is declared in other Void
@ 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
closed account (z05DSL3A)
Try giving more information, the full error text, more code, what you are trying to do...
Pages: 12