GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Jan-2008, 21:00
PC Nerd PC Nerd is offline
Awaiting Email Confirmation
 
Join Date: Feb 2007
Posts: 6
PC Nerd is on a distinguished road

#include "<string>"; - however doesnt work


Hi,

Ive included string for my program - but i get the following error when i try "string name;"


CPP / C++ / C Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>

#ifndef _FLIGHT2_H
#define _FLIGHT2_H

class Flight2 {
	private:
		string name;
....

thats the beginning - and the error is on the last line showed.

12 C:\CPP\Flight2.h
'string' is used as a type, but is not defined as a type.

Im assuming that this means its not letting me user string as a data type - however ive got another program that is exactly the same and it allows me to do it. the only difference is that thsi is a .h file building aclass whereas the other prgram is simply a program wihtougth using any custom headers taht ive created.

How can I get this header file to use string as a data type?

Thanks
  #2  
Old 08-Jan-2008, 21:05
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,620
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: #include "<string>"; - however doesnt work


Quote:
Originally Posted by PC Nerd
How can I get this header file to use string as a data type?

CPP / C++ / C Code:
#include <string>

using std::string;

(or using namespace std;)

Regards,

Dave
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot draw things in the draw area shitao1201 FLTK Forum 2 13-Nov-2007 05:14
#ifndef not working? Honourable Mist C Programming Language 8 20-Feb-2007 22:38
Random access files Krazy_yA C Programming Language 6 07-May-2006 01:44
fltk-2.0 cvs Plumb FLTK Forum 20 13-Nov-2004 07:10
help with classes bucho MS Visual C++ / MFC Forum 3 20-Oct-2004 06:16

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 14:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.