Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Error question.

Reply
Thread Tools

Error question.

 
 
JoeC
Guest
Posts: n/a
 
      09-18-2006
I am trying to write a program and I send a pointer to an object to
another object and I want to get a number out of that object It is
strange this works:

static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());

but this doesn't work:

static mapmgt m(b, trn){
xlen = b->GetSizeX();

 
Reply With Quote
 
 
 
 
Thomas Tutone
Guest
Posts: n/a
 
      09-18-2006

JoeC wrote:

> I am trying to write a program and I send a pointer to an object to
> another object and I want to get a number out of that object It is
> strange this works:
>
> static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
>
> but this doesn't work:
>
> static mapmgt m(b, trn){
> xlen = b->GetSizeX();


Why is it strange? Please post the definition of mapmgt, a complete
compilable piece of code that duplicates the error, and the exact error
message you get.

Best regards,

Tom

 
Reply With Quote
 
 
 
 
JoeC
Guest
Posts: n/a
 
      09-18-2006

Thomas Tutone wrote:
> JoeC wrote:
>
> > I am trying to write a program and I send a pointer to an object to
> > another object and I want to get a number out of that object It is
> > strange this works:
> >
> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
> >
> > but this doesn't work:
> >
> > static mapmgt m(board * b, ....
> > xlen = b->GetSizeX();

>
> Why is it strange? Please post the definition of mapmgt, a complete
> compilable piece of code that duplicates the error, and the exact error
> message you get.
>
> Best regards,
>


I am going with the first first function. The program is large and
complex. b is apointer and I can get the numbers that way but if I
send the pointer to the function it said somthing like the some value
is not an int when it is. I am just going with what what works.
> Tom


 
Reply With Quote
 
Howard
Guest
Posts: n/a
 
      09-18-2006

"JoeC" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
>
> Thomas Tutone wrote:
>> JoeC wrote:
>>
>> > I am trying to write a program and I send a pointer to an object to
>> > another object and I want to get a number out of that object It is
>> > strange this works:
>> >
>> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
>> >
>> > but this doesn't work:
>> >


What doesn't work?

>> > static mapmgt m(board * b, ....


Why do you have "board *" there? I assume you're creating a local static
object of type mapmgt, called m. Correct? In that case, ditch the "board
*" part, and just pass the parameter values.

>> > xlen = b->GetSizeX();


Perhaps you really meant to do something like this: ?

// in some function...
{
...
int xlen = b->GetSizeX();
int ylen = b->GetSizeY();
static mapmgt m(b, trn, xlen, ylen);
....
}

In which case, if you don't xlen and ylen elsewhere, why bother? Your first
example is fine.

>>
>> Why is it strange? Please post the definition of mapmgt, a complete
>> compilable piece of code that duplicates the error, and the exact error
>> message you get.
>>
>> Best regards,
>>

>
> I am going with the first first function. The program is large and
> complex. b is apointer and I can get the numbers that way but if I
> send the pointer to the function it said somthing like the some value
> is not an int when it is. I am just going with what what works.


That's fine, but in the future, if you want help, you'll need to post code
that's real, even if you change the names and even if you can only post a
few lines actually related to the error. Also, post the actual text of the
error message, not "it said somthing like the some value is not an int when
it is".

-Howard


 
Reply With Quote
 
JoeC
Guest
Posts: n/a
 
      09-18-2006

Howard wrote:
> "JoeC" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> >
> > Thomas Tutone wrote:
> >> JoeC wrote:
> >>
> >> > I am trying to write a program and I send a pointer to an object to
> >> > another object and I want to get a number out of that object It is
> >> > strange this works:
> >> >
> >> > static mapmgt m(b, trn, b->GetSizeX(), b->GetSizeY());
> >> >
> >> > but this doesn't work:
> >> >

>
> What doesn't work?
>
> >> > static mapmgt m(board * b, ....

>
> Why do you have "board *" there? I assume you're creating a local static
> object of type mapmgt, called m. Correct? In that case, ditch the "board
> *" part, and just pass the parameter values.
>
> >> > xlen = b->GetSizeX();

>
> Perhaps you really meant to do something like this: ?
>
> // in some function...
> {
> ...
> int xlen = b->GetSizeX();
> int ylen = b->GetSizeY();
> static mapmgt m(b, trn, xlen, ylen);
> ...
> }
>
> In which case, if you don't xlen and ylen elsewhere, why bother? Your first
> example is fine.
>
> >>
> >> Why is it strange? Please post the definition of mapmgt, a complete
> >> compilable piece of code that duplicates the error, and the exact error
> >> message you get.
> >>
> >> Best regards,
> >>

> >
> > I am going with the first first function. The program is large and
> > complex. b is apointer and I can get the numbers that way but if I
> > send the pointer to the function it said somthing like the some value
> > is not an int when it is. I am just going with what what works.

>
> That's fine, but in the future, if you want help, you'll need to post code
> that's real, even if you change the names and even if you can only post a
> few lines actually related to the error. Also, post the actual text of the
> error message, not "it said somthing like the some value is not an int when
> it is".
>
> -Howard


OK, thanks. some times it can be dificult to post revelent lines of
code from a complex program. I do have another question which I will
start another topic.

 
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
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0xffc Thread 0x228 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-30-2006 03:16 PM
Error connecting to SQLExpress 2005 locally (error: 26 - Error Locating Server/Instance Specified) hfk0 ASP .Net 2 03-27-2006 08:43 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 1 03-24-2006 04:20 PM
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x8fc Thread 0x934 DBC 0x437b94 Jet'. ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr bazzer ASP .Net 0 03-24-2006 02:22 PM
Error 500: ERROR: Cannot forward. Writer or Stream already obtained. Error JavaQueries Java 1 03-01-2005 06:30 PM



Advertisments