Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / #include <vector> not working

Author
Message
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Jul 2009 05:02
I'm trying to learn how to use vector arrays in my project, but it doesnt seem like including vector.h does anything, and any code i write using vectors is invalid... Take this for example:


I've never used vectors before, but from what i've read, that should be right. I guess this must be a problem with my project settings... any help?

Also, i've tried both debug and release mode, no change

Bran flakes91093
16
Years of Service
User Offline
Joined: 13th Sep 2008
Location: Crazy Land
Posted: 16th Jul 2009 05:18
What errors do you get? Does it compile?

Your_Health = (My_Mood == HAPPY) ? 100 : NULL;
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 16th Jul 2009 05:23
Just a guess....

Try adding

using namespace std;

right after you #include statements.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 16th Jul 2009 06:05
All of the Standard Template Library is contained within the namespace "std" . So you can either do what lilith suggested and include access to the entire namespace globally in your program, or you can prefix any call you make to the library with "std::".

The reason you may not want to include all of the namespace(not really a problem for the STL, but maybe for other custom libraries) is that some of your own function names may conflict with some of the function names contained in the namespace.

If it ain't broke.... DONT FIX IT !!!
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Jul 2009 06:22
Ah, yeah, that worked, thaaank you.

So, if anyone doesn't mind telling me... what's the Standard Template Library, and what's a namespace?

Iuzidal
15
Years of Service
User Offline
Joined: 25th Jun 2009
Location:
Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 16th Jul 2009 07:05
right. Thanks!

logicandchaos
15
Years of Service
User Offline
Joined: 22nd Sep 2009
Location:
Posted: 23rd Sep 2009 21:11
im getting errors when i try to include iostream or fstream is this the same problem?

logicandchaos

Login to post a reply

Server time is: 2024-11-19 00:19:17
Your offset time is: 2024-11-19 00:19:17