Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

kappa

help, std::string is an undeclared identifier???

This topic is 5546 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

prolly some misspelling somewhere, but I have stared at this for almost two hours now and I cant see why the compiler does not accept std::string. flight.h
#ifndef FLIGHT_H
#define FLIGHT_H
#include "clock.h"
#include <cstring>
using namespace std;

	class _CFlight
	{
	public:
		void init(string flight_no,
				int dep_h, int dep_m, int arr_h, int arr_m);
		void info();
		void delay(int min);
	private:
		string no;
		_CClock dep, arr;
	};

#endif
flight.cpp
#include "flight.h"
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;

void _CFlight::init(string flight_no, int dep_h, int dep_m,
				int arr_h, int arr_m)
{
	no = flight_no;
	dep.set_time(dep_h, dep_m, 0);
	arr.set_time(arr_h, arr_m, 0);
}

void _CFlight::info()
{
	cout << "Flight no " << no << endl;
	cout << "Dep:      " << dep.write(false) << endl;
	cout << "Arr:      " << arr.write(false) << endl;
	cout << endl;
}

void _CFlight::delay(int min)
{
	for(int i = 1; i <= min*60; i++)
	{
		dep.tick();
		arr.tick();
	}
}
and here is the errors I get c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.h(17): error C2146: syntax error : missing '';'' before identifier ''no'' c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.h(17): error C2501: ''_CFlight::string'' : missing storage-class or type specifiers c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.h(17): error C2501: ''_CFlight::no'' : missing storage-class or type specifiers c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.cpp(9): error C2511: ''void _CFlight::init(std::string,int,int,int,int)'' : overloaded member function not found in ''_CFlight'' c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.cpp(17): error C2065: ''no'' : undeclared identifier c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.cpp(17): error C2593: ''operator <<'' is ambiguous c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.cpp(18): error C2679: binary ''<<'' : no operator found which takes a right-hand operand of type ''void'' (or there is no acceptable conversion) c:\Documents and Settings\Ägaren\Mina dokument\Visual Studio Projects\dos\flight.cpp(19): error C2679: binary ''<<'' : no operator found which takes a right-hand operand of type ''void'' (or there is no acceptable conversion) ///////////////////////////////////////////////////////////

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!