std::vector problem

Started by
10 comments, last by Attala101 17 years, 5 months ago
No, it's not just an intellisense error. When I'm accessing the Warhead vector in the constructor it compiles, but intellisense as no idea what's going on.

In my main function however, after I have declared an instance of nationclass it gives me a compiler error when I try to access the Warhead vector.

I will try some of your suggestions later. Thanks for the replies guys.

A
Advertisement
Hi again :)

Ok, been working on this problem. I tried some of your suggestions and ended up rewriting most of the relevant code. I ended up making a separate .h and .cpp file for the cWarhead class and including the .h file in nationclass.h and my main .h. (I also changed the code so that the vector doesn't store pointers).

It actually works now. Although intellisense is still not "sensing" anything :) I tried this in my main:
cWarhead testwarhead2;USA->Warheads.push_back(testwarhead2);


This compiles. But the IDE gives me an error when I try to find the definition of Warheads, and it doesn't suggest Warheads when I write "USA->". I does however suggest access to the std::string instances in nationclass. I find this really strange.

My code is built after this example: Managing Game States with OGRE
(So when I have mentioned my "main" function I have really meant an instance of "Playstate"). I have a feeling that the way the code is built up can easily give scope problems for a newbie like me. However this does not explain the IDE's behaviour, or does it?

Anyway, it's working so I can continue working even if the IDE has no idea whats going on :)

Thanks for your help.

A101

This topic is closed to new replies.

Advertisement