![]() |
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. |
Re: OT: Stupid c++
Assign them different names, and pass the value of one to the other.
|
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.
|
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; |
Re: OT: Stupid c++
Much thanks.
|
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. |
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.
|
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. |
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. |
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(); |
All times are GMT -4. The time now is 05:57 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.