|
|
|
|
|
August 7th, 2006, 05:11 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
OT: Stupid c++ (Roguelike development)
So I'm trying to declare a vector. It declares fine in the main function. The only problem is, I need to declare it in one of the header files. Except that if I try to declare it in function I want to use it in in the header file, it tells me that ' `vector' undeclared (first use this function)'.
If I try to declare it outside the function, it tells me that 'expected constructor, destructor, or type conversion before '<' token'
So it seems like my header file can't access the vector code or something.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 7th, 2006, 06:11 PM
|
|
Second Lieutenant
|
|
Join Date: Nov 2003
Posts: 482
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Re: OT: Stupid c++
Assign them different names, and pass the value of one to the other.
__________________
The great tragedy of science...the slaying of a beautiful hypothesis by an ugly fact. (T. H. Huxley)
|
August 7th, 2006, 07:13 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
Re: OT: Stupid c++
That still doesn't fix the fact that I can't declare vectors in the header and the header is where I need to declare the vector.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 7th, 2006, 07:19 PM
|
|
National Security Advisor
|
|
Join Date: Dec 1999
Posts: 8,806
Thanks: 54
Thanked 33 Times in 31 Posts
|
|
Re: OT: Stupid c++
Vector isn't a built-in type, so you need to have something, typically in the header file, like:
#include <vector>
and probably you want:
using namespace std;
and then to declare it, something like:
vector <MouseCheeseWhatever> NarfsVector;
|
August 7th, 2006, 09:34 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
Re: OT: Stupid c++
Much thanks.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 7th, 2006, 10:22 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
Re: OT: Stupid c++
Would anyone happen to know why the computer would lock into 'drag and select' mode, generally requiring me to do a complete shut-down?
That's any part of the computer capable of 'drag and select' gets locked into that mode. It sometimes happens when I'm dragging and selecting.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 8th, 2006, 01:31 AM
|
|
National Security Advisor
|
|
Join Date: Dec 1999
Posts: 8,806
Thanks: 54
Thanked 33 Times in 31 Posts
|
|
Re: OT: Stupid c++
Sounds like your mouse button is getting stuck in a down position, or software (mouse driver, or some program messing with mouse messages in a bad way) is messing up the mouse. Like, saying it has handled the MouseUp message and not passing it on to other software, so other programs don't see the MouseUp event so it's like your mouse button is stuck down.
|
August 8th, 2006, 04:22 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
Re: OT: Stupid c++
I think it's my keyboard - Tapping the shift key has helped twice now, so it's probably dying.
The mouse is only about 6+ months old; can't remember when we got the keyboard, but it's outlasted at least two processors, I think.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 8th, 2006, 05:44 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Mar 2003
Location: CHEESE!
Posts: 10,009
Thanks: 0
Thanked 7 Times in 1 Post
|
|
Re: OT: Stupid c++
What does 'expected primary-expression before '.' token' mean? I'm trying to make a pointer for a base class equal to one of its derived classes.
Thanks again.
__________________
If I only could remember half the things I'd forgot, that would be a lot of stuff, I think - I don't know; I forgot!
A* E* Se! Gd! $-- C-^- Ai** M-- S? Ss---- RA Pw? Fq Bb++@ Tcp? L++++
Some of my webcomics. I've got 400+ webcomics at Last count, some dead.
Sig updated to remove non-working links.
|
August 8th, 2006, 05:48 PM
|
|
Shrapnel Fanatic
|
|
Join Date: Jul 2001
Location: Southern CA, USA
Posts: 18,394
Thanks: 0
Thanked 12 Times in 10 Posts
|
|
Re: OT: Stupid c++
Ah, the joys of dereferencing.
. is used to access members of an object.
-> is used to access members of an object when you have a pointer to that object.
If you have:
object* MyObjectPtr = new object();
then you have to access members via:
MyObjectPtr->member();
Whereas if you have just:
object MyObject;
you use:
MyObject.member();
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|