Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > compiler madness??

Reply
Thread Tools

compiler madness??

 
 
g
Guest
Posts: n/a
 
      03-04-2006
#ifndef SERVICE_HANDLER_H_
#define SERVICE_HANDLER_H_
#include <string>
#include <map>

class Services;

class Service_Handler
{
public:
Service_Handler();
virtual ~Service_Handler();
Services* getService(std::string transaction,std::string arguments);
private:
std::map<std::string,Services*> transactions;
};

#endif /*SERVICE_HANDLER_H_*/


#include "Service_Handler.h"
#include "Services.h"
#include "CreateCustomer.h"

Service_Handler::Service_Handler()
{
transactions["aaa"]=new Services;
}

Service_Handler::~Service_Handler()
{
transactions.erase("aaa");
}

Services* getService(std::string transaction,std::string arguments)
{
transactions.erase("aaa");
return NULL;
}

.../Service_Handler.cpp: In function 'Services*
getService(std::string, std::string)':
.../Service_Handler.cpp:17: error: 'transactions' was not declared
in this scope
!!!!!!!!!!!!
how it's possible??????????
why I can't use transactions in getService()????
please help!

 
Reply With Quote
 
 
 
 
Uwe Grawert
Guest
Posts: n/a
 
      03-04-2006
g wrote:
> #ifndef SERVICE_HANDLER_H_
> #define SERVICE_HANDLER_H_
> #include <string>
> #include <map>
>
> class Services;
>
> class Service_Handler
> {
> public:
> Service_Handler();
> virtual ~Service_Handler();
> Services* getService(std::string transaction,std::string arguments);
> private:
> std::map<std::string,Services*> transactions;
> };
>
> #endif /*SERVICE_HANDLER_H_*/
>
>
> #include "Service_Handler.h"
> #include "Services.h"
> #include "CreateCustomer.h"
>
> Service_Handler::Service_Handler()
> {
> transactions["aaa"]=new Services;
> }
>
> Service_Handler::~Service_Handler()
> {
> transactions.erase("aaa");
> }
>
> Services* getService(std::string transaction,std::string arguments)
> {
> transactions.erase("aaa");
> return NULL;
> }
>
> ../Service_Handler.cpp: In function 'Services*
> getService(std::string, std::string)':
> ../Service_Handler.cpp:17: error: 'transactions' was not declared
> in this scope
> !!!!!!!!!!!!
> how it's possible??????????
> why I can't use transactions in getService()????
> please help!
>


You forgot the scope for getService() it is:
Service_Handler::getService(). try it!
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      03-04-2006
g wrote:
> #ifndef SERVICE_HANDLER_H_
> #define SERVICE_HANDLER_H_
> #include <string>
> #include <map>
>
> class Services;
>
> class Service_Handler
> {
> public:
> Service_Handler();
> virtual ~Service_Handler();
> Services* getService(std::string transaction,std::string arguments);


I strongly recommend declaring your arguments 'std::string const &'.

> private:
> std::map<std::string,Services*> transactions;
> };
>
> #endif /*SERVICE_HANDLER_H_*/
>
>
> #include "Service_Handler.h"
> #include "Services.h"
> #include "CreateCustomer.h"
>
> Service_Handler::Service_Handler()
> {
> transactions["aaa"]=new Services;
> }
>
> Service_Handler::~Service_Handler()
> {
> transactions.erase("aaa");
> }
>
> Services* getService(std::string transaction,std::string arguments)


Did you mean

Services* Service_Handler::getService( ...

???

> {
> transactions.erase("aaa");
> return NULL;
> }
>
> ../Service_Handler.cpp: In function 'Services*
> getService(std::string, std::string)':
> ../Service_Handler.cpp:17: error: 'transactions' was not declared
> in this scope
> !!!!!!!!!!!!
> how it's possible??????????
> why I can't use transactions in getService()????


You need to make sure you're actually defining a _member_.

Don't be too hard on yourself. Those things happen.

V
--
Please remove capital As from my address when replying by mail


 
Reply With Quote
 
g
Guest
Posts: n/a
 
      03-04-2006
Ohhhh my god!!!!!!!!
I dont believe it.......so stupid

thanks a lot!

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiler Error Message: The compiler failed with error code -1073741819 Ram ASP .Net 0 09-13-2005 09:52 AM
Why is a JIT compiler faster than a byte-compiler RickMuller Python 4 03-26-2005 04:30 PM
Compiler compiler with C++ as output Andrey Batyuck C++ 3 05-17-2004 08:17 PM
Can we use <compiler> tag to avoid RunTime Compiler error? Jack Wright ASP .Net 5 01-19-2004 04:36 PM
Compiler Error Message: The compiler failed with error code 128. Yan ASP .Net 0 07-21-2003 10:49 PM



Advertisments