Can anyone help me with some errors, i have no idea why they are coming up
15 replies, posted
These are the errors:
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(29) : error C2065: 'coords' : undeclared identifier
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : error C2011: 'Rect' : 'struct' type redefinition
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rock.h(18) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2227: left of '->x' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2227: left of '->x' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2227: left of '->w' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2227: left of '->x' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2227: left of '->w' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2227: left of '->x' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2227: left of '->y' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2227: left of '->y' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2227: left of '->h' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2227: left of '->y' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2227: left of '->h' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2027: use of undefined type 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(4) : see declaration of 'Rect'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2227: left of '->y' must point to class/struct/union/generic type
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2664: 'isCollision' : cannot convert parameter 1 from 'Rect' to 'Rect'
Source or target has incomplete type
[/code]
I have a struct in a file called rect.h
[code]
#include <allegro.h>
#include <cstdlib>
struct Rect {
int x,y,w,h;
};
[/code]
And i have a collision detection function in misc.h
[code]
#include <allegro.h>
#include <cstdlib>
#include "rect.h"
bool isCollision(Rect *r1, Rect *r2) {
if ( r1->x < r2->x + r2->w &&
r1->x + r1->w > r2->x &&
r1->y < r2->y + r2->h &&
r1->y + r1->h > r2->y ) {
return true;
} else {
return false;
}
}
[/code]
in player.h and rock.h i have some functions to return a Rect struct with the collision values...
[code]
Rect returnCoords() {
return coords;
}
[/code]
I set the value of coords here:
[code]
void Player::draw(BITMAP *buffer) {
BITMAP *image;
image = load_bitmap( "sprites.bmp", NULL );
if (moveDir == LEFT) {
masked_blit(image, buffer, 5, 97, x, y, 26, 47);
coords->x = 5;
coords->y = 97;
coords->w = 26;
coords->h = 47;
} else if (moveDir == RIGHT) {
masked_blit(image, buffer, 2, 145, x, y, 25, 46);
coords->x = 2;
coords->y = 145;
coords->w = 25;
coords->h = 46;
} else if (moveDir == UP) {
masked_blit(image, buffer, 6, 51, x, y, 21, 44);
coords->x = 6;
coords->y = 51;
coords->w = 21;
coords->h = 44;
} else if (moveDir == DOWN) {
masked_blit(image, buffer, 6, 3, x, y, 21, 44);
coords->x = 6;
coords->y = 3;
coords->w = 21;
coords->h = 44;
}
clear_bitmap( image );
destroy_bitmap( image );
}
[/code]
and in main.cpp i check for collision...
[code]
...
#include "rect.h"
...
if (isCollision(player.returnCoords(), rock.returnCoords())) {
if (player.returnPoints() > 5 && player.returnPoints() < 11) {
multi++; // 2
} else if (player.returnPoints() > 10 && player.returnPoints() < 101) {
multi++; // 3
} else if (player.returnPoints() > 100 && player.returnPoints() < 501) {
multi++; // 4
} else if (player.returnPoints() > 500 && multi != 5) {
multi++; // 5
}
player.givePoint((1*multi));
}
...
[/code]
So, what am i doing wrong?
I think you're just missing [url=http://en.wikipedia.org/wiki/Include_guard#Use_of_.23include_guards]include guards[/url].
Ok. That takes away a lot of errors, but i get these:
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(29) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rock.h(19) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2100: illegal indirection
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2100: illegal indirection
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2664: 'isCollision' : cannot convert parameter 1 from 'Rect' to 'Rect *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
[/code]
And i here is the collision detection and implementation of it:
[code]
bool isCollision(Rect *r1, Rect *r2) {
if ( (r1->x < r2->x + r2->w) &&
(r1->x + r1->w > r2->x) &&
(r1->y < r2->y + r2->h) &&
(r1->y + r1->h > r2->y) ) {
return true;
} else {
return false;
}
}
if (isCollision(*player.returnCoords(), *rock.returnCoords())) {
if (player.returnPoints() > 5 && player.returnPoints() < 11) {
multi++; // 2
} else if (player.returnPoints() > 10 && player.returnPoints() < 101) {
multi++; // 3
} else if (player.returnPoints() > 100 && player.returnPoints() < 501) {
multi++; // 4
} else if (player.returnPoints() > 500 && multi != 5) {
multi++; // 5
}
player.givePoint((1*multi));
}
[/code]
Take out your stars, they're for dereferencing.
Or, keep them in, and pass by reference to begin with.
[cpp]
bool isCollision(const Rect& r1, const Rect& r2) {
if ( (r1.x < r2.x + r2.w) &&
(r1.x + r1.w > r2.x) &&
(r1.y < r2.y + r2.h) &&
(r1.y + r1.h > r2.y) ) {
return true;
} else {
return false;
}
}[/cpp]
Ok, took out the stars:
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(29) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rock.h(19) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(7) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(8) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(9) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\misc.h(10) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2664: 'isCollision' : cannot convert parameter 1 from 'Rect *' to 'Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
[/code]
What is the return type for returnCoords?
To fix most of those errors, just remember that you access references with a dot, not ->. The -> syntax is only for pointers to objects, or objects that overload it.
Oh, ok.
And the return type is Rect
I get the following erros...
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(29) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rock.h(19) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\main.cpp(98) : error C2664: 'isCollision' : cannot convert parameter 1 from 'Rect *' to 'Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
[/code]
Thanks for the help, by the way.
Just saw this in your code
[cpp]
image = load_bitmap( "sprites.bmp", NULL );
[/cpp]
You really shouldn't load the image every single time you draw it, just load it once and save it.
[QUOTE=Dr Magnusson;19561207]Just saw this in your code
[cpp]
image = load_bitmap( "sprites.bmp", NULL );
[/cpp]
You really shouldn't load the image every single time you draw it, just load it once and save it.[/QUOTE]
I'll fix that later. im just trying to get it to work, then i will do that.
[QUOTE=i300;19560942]Oh, ok.
And the return type is Rect
I get the following erros...
[code]
-snip-
[/code]
Thanks for the help, by the way.[/QUOTE]
If the return type is plain "Rect" (not a pointer to it, and not a reference), then you'd do:
[cpp]
if (isCollision(player.returnCoords(), rock.returnCoords())) {
/*snip*/
}[/cpp]
Where isCollision would be the function I provided above. That way you don't have to take the address of anything, and you don't have to do any dereferencing.
You might want to consider having returnCoords return a (const if you want encapsulation) reference too.
I still get this:
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(29) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rock.h(19) : error C2664: 'Rect::Rect(const Rect &)' : cannot convert parameter 1 from 'Rect *' to 'const Rect &'
Reason: cannot convert from 'Rect *' to 'const Rect'
No constructor could take the source type, or constructor overload resolution was ambiguous
[/code]
Are you sure it returns Rect and not Rect*?
Rect* means pointer-to-Rect.
Yes. It returns Rect.
[code]
if (isCollision(player.returnCoords(), rock.returnCoords())) {
if (player.returnPoints() > 5 && player.returnPoints() < 11) {
multi++; // 2
} else if (player.returnPoints() > 10 && player.returnPoints() < 101) {
multi++; // 3
} else if (player.returnPoints() > 100 && player.returnPoints() < 501) {
multi++; // 4
} else if (player.returnPoints() > 500 && multi != 5) {
multi++; // 5
}
player.givePoint((1*multi));
}
Rect Player::returnCoords() {
return coords;
}
[/code]
EDIT:
I had the variables as
Rect *coords;
Its now
Rect coords;
But i get these:
[code]
Compiling...
main.cpp
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(81) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(81) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(82) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(82) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(83) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(83) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(84) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(84) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(87) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(87) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(88) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(88) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(89) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(89) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(90) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(90) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(93) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(93) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(94) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(94) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(95) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(95) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(96) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(96) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(99) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(99) : error C2232: '->Rect::x' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(100) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(100) : error C2232: '->Rect::y' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(101) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(101) : error C2232: '->Rect::w' : left operand has 'struct' type, use '.'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(102) : error C2819: type 'Rect' does not have an overloaded member 'operator ->'
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\rect.h(7) : see declaration of 'Rect'
did you intend to use '.' instead?
c:\users\jerish\desktop\games\dgdk\pickinrocks\pickinrocks\player.h(102) : error C2232: '->Rect::h' : left operand has 'struct' type, use '.'
[/code]
But i am not using -> anymore, i am using:
[code]
bool isCollision(Rect r1, Rect r2) {
if ( (r1.x < r2.x + r2.w) &&
(r1.x + r1.w > r2.x) &&
(r1.y < r2.y + r2.h) &&
(r1.y + r1.h > r2.y) ) {
return true;
} else {
return false;
}
}
[/code]
It's trying to copy construct a Rect object from a Rect* somewhere.
Post the lines your errors are coming from.
I got it. Thanks guys!
Ill post the source and .exe of my game when i finish it, sometime this week!
[QUOTE=i300;19563195]I got it. Thanks guys!
Ill post the source and .exe of my game when i finish it, sometime this week![/QUOTE]
Be sure to license it! ;)
Sorry, you need to Log In to post a reply to this thread.