Yes.
Do you have a problem with your code? Follow the recommendations in
FAQ 5.8.
Victor
Ok ... I do not receive error from the compiler but from the linker .
I am using Visual C++
Here is my code (HTTPClient is another class , and String is my own
string class )
#include "HTTPClient.h"
#ifndef _GET_USERNAME_STRING
#define _GET_USERNAME_STRING 0
#endif
#ifndef _GET_PASSWORD_STRING
#define _GET_PASSWORD_STRING 1
#endif
#ifndef _GET_IP_STRING
#define _GET_IP_STRING 2
#endif
class AP : public HTTPClient
{
public:
// Constructors and Destructors .....
AP(); // <-- Where
no parameters are passed ....
AP(String,String,String); // <-- Where all of the
parameters are passed .
AP(String); // <-- Where only the ip address
is passed
~AP();
// Accessors ...
void GetApInfo(void); // should that called
from the constructor ??
void GetApStatistics(int); // int paramter ????
String PromptUserForInput(unsigned short); // another parameter ?
exactly !!
void ApSet_Channel(unsigned short);
int ApGet_Channel(void);
String ApGet_SSID(void);
String ApGet_SubnetMask(void);
void ApSet_SubnetMask(String);
String ApSet_MACAddress(void);
void ApSet_MACAddress(String);
String ApGet_EncryptionMethod(void);
void ApSet_EncryptionMethod(String);
// protected members ..
protected:
String Ap_ip;
String Ap_usrnam;
String Ap_passwd;
// private members ...
private:
String MAC_Address;
bool Ap_Encryption_Function;
int Ap_Channel; //needs somehow casting ...
!!
String Ap_SSID;
String Ap_SubnetMask;
String Ap_GetAway;
String Ap_Mode;
String Ap_DHCP_Mode;
// for the main program , to distinguish access points between
them
unsigned short Ap_ID;
// What should i put here ????
};
// Default constructor , used when you have not pass any of the three
required para
AP::AP(void)
{
cout << "Default Constructor called ... \n" ;
// What should that do ??
}
AP::AP(String ip)
{
cout << " Needed authorization to proceed \n";
Ap_usrnam=PromptUserForInput(_GET_USERNAME_STRING);
Ap_passwd=PromptUserForInput(_GET_PASSWORD_STRING);
if ( (strcmp(Ap_usrnam.GetString()," ") ==0) ||
(strcmp(Ap_passwd.GetString()," ")==0))
{
cout << "Error(Non Fatal) You did not entered one of
the two fields \n";
exit(EXIT_FAILURE);
}
}
AP::AP(String ip,String usernam,String pass)
{
if ( (strcmp(Ap_usrnam.GetString()," ") ==0) ||
(strcmp(Ap_passwd.GetString()," ")==0))
{
cout << "Error(Non Fatal) You did not entered one of
the two fields \n";
exit(EXIT_FAILURE);
}
}
// function to be replaced with the onStream operator
String PromptUserForInput(unsigned short param)
{
String tempString(20);
char c;
int i=0;
switch(param)
{
case _GET_USERNAME_STRING:
{
cout << "Please enter your username\n" ;
break;
}
case _GET_PASSWORD_STRING:
{
cout << "Please enter your password\n" ;
break;
}
case _GET_IP_STRING:
{
cout << "Please Give me the Ip Address of the
Access Point \n" ;
break;
}
default:
{
cout << "Error(Non Fatal) Wrong parameter to
AP:
romptUserForInput \n" ;
exit(EXIT_FAILURE);
// return ???
}
}
while( (c=getchar()) !='\n')
{
tempString
=c;
i++;
}
return tempString;
}
int main(void)
{
AP Dlink();
cout << "Hello world .... \n" ;
return 0;
}
The problem is with the PromptUserForInput .... The compilation does
not generate any errors but the linker complains about the following :
FinalCpp.obj : error LNK2001: unresolved external symbol "public:
class String __thiscall AP:romptUserForInput(unsigned short)"
(?PromptUserForInput@AP@@QAE?AVString@@G@Z)
Debug/FinalCpp.exe : fatal error LNK1120: 1 unresolved externals