| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"hyderabadblues" |
| Date: |
15 May 2007 07:43:59 AM |
| Object: |
qualified name is not allowed |
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
.
|
|
| User: "hyderabadblues" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 07:45:20 AM |
|
|
I forgot to paste the problem,
While executing following code( I have removed code that Im not
suppossed to post).I am getting the error as qualified name is not
allowed at the line where an object of auto_ptr is declared.Can some
tell me what is the problem
On May 15, 2:43 pm, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
.
|
|
|
|
| User: "peter koch" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 08:59:52 AM |
|
|
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't have an answer, but the only problem (from a legal point of
view) I can see with this code is the use of a reserved name for the
struct. I assume that tU16 and tU32 are proper names.
Well... right now I see that you haven't qualified auto_ptr. Don't you
believe that this should be std::auto_ptr?
/Peter
.
|
|
|
| User: "hyderabadblues" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:25:22 AM |
|
|
On May 15, 3:59 pm, peter koch <peter.koch.lar...@gmail.com> wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't have an answer, but the only problem (from a legal point of
view) I can see with this code is the use of a reserved name for the
struct. I assume that tU16 and tU32 are proper names.
Well... right now I see that you haven't qualified auto_ptr. Don't you
believe that this should be std::auto_ptr?
/Peter
I have an initial declaration using namespace std
.
|
|
|
| User: "Howard" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 11:27:58 AM |
|
|
"hyderabadblues" <sirishkumar@gmail.com> wrote in message
news:1179239122.048388.122470@o5g2000hsb.googlegroups.com...
using namespace std;
/Peter
I have an initial declaration using namespace std
Not related to your problem, but if this is in a header file, then it's not
a great idea to do that. You're forcing every file that uses this header to
bring in the entire std namespace. It's preferred to either use
"std::auto_ptr", or to use "using std::auto_ptr".
-Howard
.
|
|
|
|
|
| User: "Victor Bazarov" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:01:26 AM |
|
|
peter koch wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't have an answer, but the only problem (from a legal point of
view) I can see with this code is the use of a reserved name for the
struct. I assume that tU16 and tU32 are proper names.
Well... right now I see that you haven't qualified auto_ptr. Don't you
believe that this should be std::auto_ptr?
I am guessing you didn't see the "using" directive up on top...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
| User: "peter koch" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:27:40 AM |
|
|
On 15 Maj, 16:01, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
peter koch wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
I don't have an answer, but the only problem (from a legal point of
view) I can see with this code is the use of a reserved name for the
struct. I assume that tU16 and tU32 are proper names.
Well... right now I see that you haven't qualified auto_ptr. Don't you
believe that this should be std::auto_ptr?
I am guessing you didn't see the "using" directive up on top...
You guessed right ;-)
V
.
|
|
|
|
|
|
| User: "=?iso-8859-1?q?Erik_Wikstr=F6m?=" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 08:03:38 AM |
|
|
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't know if this is the problem (since my slightly modified
version compiles just fine on VC++8) but in C++ you normally declare a
struct like this:
struct Name
{
int members;
};
with no typedefs.
--
Erik Wikstr=F6m
.
|
|
|
| User: "hyderabadblues" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 08:11:14 AM |
|
|
On May 15, 3:03 pm, Erik Wikstr=F6m <eri...@student.chalmers.se> wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't know if this is the problem (since my slightly modified
version compiles just fine on VC++8) but in C++ you normally declare a
struct like this:
struct Name
{
int members;
};
with no typedefs.
--
Erik Wikstr=F6m
I have also tried changing the structure declatration. but it didnt
worked
.
|
|
|
| User: "Salt_Peter" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:23:27 AM |
|
|
On May 15, 9:11 am, hyderabadblues <sirishku...@gmail.com> wrote:
On May 15, 3:03 pm, Erik Wikstr=F6m <eri...@student.chalmers.se> wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
I don't know if this is the problem (since my slightly modified
version compiles just fine on VC++8) but in C++ you normally declare a
struct like this:
struct Name
{
int members;
};
with no typedefs.
--
Erik Wikstr=F6m
I have also tried changing the structure declatration. but it didnt
worked
First, auto_ptr doesn't exist, you need to #include <memory> and then
use std::auto_ptr.
Then, any identifier that uses an underscore + a capital letter is
implementation reserved.
So _MessageDataForMethodResultExecuteTest is just begging for
problems.
See if you can follow the following code as a guide:
#include <iostream>
#include <memory>
struct N
{
N(int n) : m_n(n) { std::cout << "N()\n"; }
~N() { std::cout << "~N()\n"; }
int get() const { return m_n; }
private:
int m_n;
};
class Test
{
std::auto_ptr< N > ap;
public:
Test(int r) : ap( new N(r) )
{
std::cout << "Test()\n";
}
~Test() { std::cout << "~Test()\n"; }
int get() const { return ap->get(); }
private:
Test(const Test& copy); // disabled
};
int main()
{
Test instance(99);
std::cout << instance.get() << std::endl;
}
/*
N()
Test()
99
~Test()
~N()
*/
.
|
|
|
|
| User: "Victor Bazarov" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:00:14 AM |
|
|
hyderabadblues wrote:
On May 15, 3:03 pm, Erik Wikström <eri...@student.chalmers.se> wrote:
On 15 Maj, 14:43, hyderabadblues <sirishku...@gmail.com> wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
This is a reserved identifier. You're not supposed to use it.
};
I am using RVCT compiler( ARM )
I don't know if this is the problem (since my slightly modified
version compiles just fine on VC++8) but in C++ you normally declare
a struct like this:
struct Name
{
int members;
};
with no typedefs.
--
Erik Wikström
I have also tried changing the structure declatration. but it didnt
worked
FAQ 5.8. Please read it. You will understand (hopefully) why we
do not like to guess [whether you included <memory>, whether you
have other macros that change the actual code, etc.]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
|
|
|
| User: "Fei Liu" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:02:00 AM |
|
|
hyderabadblues wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
auto_ptr is used in the context of RAII, in this case there is no
resource allocated and acquired at all. I would check if that's the
cause of the error you see.
.
|
|
|
| User: "hyderabadblues" |
|
| Title: Re: qualified name is not allowed |
15 May 2007 09:29:21 AM |
|
|
On May 15, 4:02 pm, Fei Liu <fei...@aepnetworks.com> wrote:
hyderabadblues wrote:
using namespace std;
typedef struct
{
tU16 u16AppID;
tU16 u16RegisterID;
tU16 u16CmdCounter;
tU16 u16FunctionID;
tU16 u16SourceSubID;
tU32 u32InternalData;
} trMessageDataForMethodResult;
class ExecuteTest
{
auto_ptr< trMessageDataForMethodResult >
_MessageDataForMethodResultExecuteTest;
};
I am using RVCT compiler( ARM )
auto_ptr is used in the context of RAII, in this case there is no
resource allocated and acquired at all. I would check if that's the
cause of the error you see.
It is a member variable, I will initialize it in the actual class
definition.
.
|
|
|
|
|

|
Related Articles |
|
|