i can't RESOLVE a PROBLEM !!!!

the error is

1
2
3
4
Active.cpp: In member function `void Fetcher::fetch()':
Active.cpp:173: error: `mytext' undeclared (first use this function)
Active.cpp:173: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [Active.o] Erreur 1


'mytext is declared in ( class eBibleMainWindow: )

1
2
// the textinput
eTextInputField *mytext;


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// The Class declaration of our Http Connection system
class Fetcher : public eWindow
{
	// The temp file in which we will store the download data
	eString tempPath;
	// internal pointers and functions of download connection
		eHTTPDataSource * createDownloadSink(eHTTPConnection *conn);	
public:
	Signal1<void,int> downloadDone;
	void fetch();
	
};

// The Class declaration of our Main Window
class eBibleMainWindow: public eWindow
{
	// the label to show the text
	eLabel *label;
	// the button to start connection
	eButton *ok;
	// the textinput
       	// flag to indicate the download state
	int downloadDoneFlag;
	int inDownloadFlag;
public:
	// the constructor.
	eBibleMainWindow();
	// function to call when button is pushed 
	void Wconnect();
	// function to call when download is completed.
	void downloadDone(int er);
		// the destructor.
	~eBibleMainWindow();
};

eBibleMainWindow::eBibleMainWindow(): eWindow(1)
{
	inDownloadFlag = 0;
		// move our dialog to 100.100...
	cmove(ePoint(100, 150));
		// ...and give x and y dimensions.
	cresize(eSize(460, 200));
		// set a title.
	setText("Server Activation Tool... By .:: ZEOS ::.");
	
	// create a label to show a text.
	label=new eLabel(this);
	// give a position
	label->move(ePoint(10, 30));
	// set the label dimensions
	label->resize(eSize(500, 480));
	/// 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();
	// create button and set properties
	k->move(ePoint((clientrect.width() - 140)/2, clientrect.height() - 60));
	ok->resize(eSize(130, 40));
	ok->setShortcut("green");
	ok->setShortcutPixmap("green");
	ok->loadDeco();
	//set focus to textinput
     	setFocus(mytext);
	// function to call when button is pushed
    CONNECT(ok->selected, eBibleMainWindow::Wconnect);
		
}

void eBibleMainWindow::Wconnect()
{
		// Set the flag that indicates we are in downlading status
	if(!inDownloadFlag) {	
		inDownloadFlag = 1;
		// Hide Label to change text
		label->hide();
		// Hide mytext to change text
		mytext->hide();
		ok->hide();
		// Set new text for the label
		label->setText("    \n\n       Wait please connecting to server in progress...");
		// Show the label with New Text
		label->show();
		// Function to call when donwload is complete
		CONNECT(theFetcher.downloadDone, eBibleMainWindow::downloadDone);
		// Set the flag indicates that we are starting connections
		downloadDoneFlag = 0;
		// Call function to start http connection
		theFetcher.fetch();
	}
}

void Fetcher::fetch()
{
	// declare variable
	eString url, code;
	code = mytext->getText();
	// assign to the variable the url we want to connect
	url = http://www.host.com/activate.php"+code;
	// assign to class variable the temporary file we will use to store the dowanloaded data
	tempPath = "/var/tmp/bdemo.sh";
	// inizialize the control error flag
	int error = 0;
	// start connection
	// Show a Messagebox in case of connection error
	if(!connectionP || error)
	{	eMessageBox msg("Error... network connections (" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
		msg.show();     msg.exec();     msg.hide();
	}
	else
	{
		//if the connection is estabilished start the download funcions
		CONNECT(connectionP->transferDone, Fetcher::transferDone);
		CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
		// set the user-agent name
				connectionP->start();
	}
}
Last edited on
Your 'Fetcher' class doesn't know about 'mytext' since it is a member of 'eBibleMainWindow'.
so how i can resolve it ???
Last edited on
It really depends largely on how your overall design is set up. But, to give a solution: you could consider changing the member function 'fetch' to take a parameter that is a reference or pointer to the 'eTextInputField' mytext object. I prefer using a reference, but since in your 'eBibleMainWindow' class the 'eTextInputField' member is a pointer, go with that:

 
void Fetcher::fetch(eTextInputField* const obj) const;


That's one way to do it. Let's see if someone else has a better way to do it.
Last edited on
1
2
3
4
5
6
Active.cpp:169: error: prototype for `void Fetcher::fetch(const eTextInputField*) const' does not match any in class `Fetcher'
Active.cpp:52: error: candidate is: void Fetcher::fetch()
Active.cpp:169: error: declaration of `void Fetcher::fetch(const eTextInputField*) const' outside of class is not definition
Active.cpp:170: error: expected unqualified-id before '{' token
Active.cpp:170: error: expected `,' or `;' before '{' token
make: *** [Active.o] Erreur 1 
You have some syntax errors and your the two signatures of fetch() don't match. One has no parameters and the other has one.
You have to change the definition of the 'fetch' function in the class definition as well.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// The Class declaration of our Http Connection system
class Fetcher : public eWindow
{
	// The temp file in which we will store the download data
	eString tempPath;
	// internal pointers and functions of download connection
	eHTTPConnection * connectionP;
	eHTTPDataSource * dataSinkP;
	void transferDone(int err);
	eHTTPDataSource * createDownloadSink(eHTTPConnection *conn);	
public:
	Signal1<void,int> downloadDone;
	void fetch(eTextInputField* const) const;
	
};

Last edited on
1
2
3
4
5
6
7
8
Active.cpp: In member function `void eBibleMainWindow::Wconnect()':
Active.cpp:165: error: no matching function for call to `Fetcher::fetch()'
Active.cpp:52: note: candidates are: void Fetcher::fetch(const eTextInputField*) const
Active.cpp: At global scope:
Active.cpp:169: error: declaration of `void Fetcher::fetch(const eTextInputField*) const' outside of class is not definition
Active.cpp:170: error: expected unqualified-id before '{' token
Active.cpp:170: error: expected `,' or `;' before '{' token
 
You will have to change the way you call the fetch function anywhere in your program. You now have to pass a eTextInputField pointer.

1
2
3
4
void eBibleMainWindow::Wconnect()
...
thefetcher.fetch(mytext);
...


Also, in the fetch function you will need to change this line:
 
code = mytext->getText();

You will need to change 'mytext' to whatever you named the formal parameter.
dont' work !!!
As in it still won't compile, or it doesn't work at runtime? If it won't compile, let's see the compile errors.
please can you add your reponse in my programme i can't resolve by myself
the problem still exit i will be crazy ... please EXPERT !!!

what i need with this programme is /

when i type the code (eTextInputField *mytext)
the code is added to the url and it connect to the site for verifie the code

code = mytext->getText();
url = "http://www.host.com/activate.php/?code="+code;


1
2
3
4
Active.cpp: In member function `void Fetcher::fetch()':
Active.cpp:175: error: `mytext' undeclared (first use this function)
Active.cpp:175: error: (Each undeclared identifier is reported only once for each function it appears in.)
make: *** [Active.o] Erreur 1
Last edited on
Post your entire Fetcher class along with the fetch function code as you have it and are trying to compile. I don't think you have made the changes that I said were necessary.
Why don't you just use inheritance? Instead of defining fetchers inside main window just have main window inherit fetchers members. Or an I just dumb and your already doing that.
Last edited on
I suppose inheriting from Fetcher would work, but I don't think that would be quite right. Inheritance implies an 'is a...' relationship. I'm not really seeing a 'eBibleMainWindow' as a Fetcher.

Update - I changed the code slightly in my previous posts. I was incorrect in making the parameter a 'const eTextInputField*'. It should have been a 'eTextInputField* const' so that the object can be modified within the function body.
I suppose inheriting from Fetcher would work, but I don't think that would be quite right. Inheritance implies an 'is a...' relationship. I'm not really seeing a 'eBibleMainWindow' as a Fetcher.

So true. But thats just what came to mind at first.
please how can resolve probleme show me in the programme
Comments added next to the lines I changed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// The Class declaration of our Http Connection system
class Fetcher : public eWindow
{
	// The temp file in which we will store the download data
	eString tempPath;
	// internal pointers and functions of download connection
	eHTTPConnection * connectionP;
	eHTTPDataSource * dataSinkP;
	void transferDone(int err);
	eHTTPDataSource * createDownloadSink(eHTTPConnection *conn);	
public:
	Signal1<void,int> downloadDone;
	void fetch(eTextInputField* const) const;  // CHANGED THIS LINE
	
};

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
void Fetcher::fetch(eTextInputField* const obj) const  // CHANGED THIS LINE
{
	// declare variable
	eString url, code;
	code = obj->getText();  // CHANGED THIS LINE
	// assign to the variable the url we want to connect
	url = "http://www.host.com/activate.php/?code="+code;
	// assign to class variable the temporary file we will use to store the dowanloaded data
	tempPath = "/var/tmp/bdemo.sh";
	// inizialize the control error flag
	int error = 0;
	// start connection
	connectionP = eHTTPConnection::doRequest(url.c_str(), eApp, &error);
	// Show a Messagebox in case of connection error
	if(!connectionP || error)
	{	eMessageBox msg("Error... network connections (" + eString().sprintf("%d", error) + ")", _("Details"), eMessageBox::btOK);
		msg.show();     msg.exec();     msg.hide();
	}
	else
	{
		//if the connection is estabilished start the download funcions
		CONNECT(connectionP->transferDone, Fetcher::transferDone);
		CONNECT(connectionP->createDataSource, Fetcher::createDownloadSink);
		// set the user-agent name
		connectionP->local_header["User-Agent"] = "Super-Code";
		connectionP->start();
	}
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void eBibleMainWindow::Wconnect()
{
		// Set the flag that indicates we are in downlading status
	if(!inDownloadFlag) {	
		inDownloadFlag = 1;
		// Hide Label to change text
		label->hide();
		// Hide mytext to change text
		mytext->hide();
		ok->hide();
		// Set new text for the label
		label->setText("    \n\n       Wait please connecting to server in progress...");
		// Show the label with New Text
		label->show();
		// Function to call when donwload is complete
		CONNECT(theFetcher.downloadDone, eBibleMainWindow::downloadDone);
		// Set the flag indicates that we are starting connections
		downloadDoneFlag = 0;
		// Call function to start http connection
		theFetcher.fetch(this->mytext);  // CHANGED THIS LINE
	}
}
Last edited on
the probleme is resolved thanks you Mr sadavied it work perfectly... thanks you ..men
Topic archived. No new replies allowed.