f



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 )

0
5/15/2007 12:43:59 PM
comp.lang.c++ 49423 articles. 6 followers. Post Follow

12 Replies
1949 Views

Similar Articles

[PageSpeed] 15

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 )


0
5/15/2007 12:45:20 PM
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

0
eriwik (511)
5/15/2007 1:03:38 PM
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

0
5/15/2007 1:11:14 PM
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

0
5/15/2007 1:59:52 PM
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 


0
v.Abazarov (13256)
5/15/2007 2:00:14 PM
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 


0
v.Abazarov (13256)
5/15/2007 2:01:26 PM
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.
0
feiliu (123)
5/15/2007 2:02:00 PM
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()
*/

0
pj_hern (970)
5/15/2007 2:23:27 PM
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

0
5/15/2007 2:25:22 PM
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

0
5/15/2007 2:27:40 PM
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.

0
5/15/2007 2:29:21 PM
"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



0
alicebt (1862)
5/15/2007 4:27:58 PM
Reply: