Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2008, 09:13 PM
Registered User
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cupido Send a message via Yahoo to cupido
Default Why does it show error C2228?

hi...i am new with this forum and new to VC++ too..I am facing some problem and can't solve it.Please help me ya... :) Thanks o...

this is my header file:
#include "StdAfx.h"

#ifndef FLIGHT_H
#define FLIGHT_H


#include <string>
using std::string;


class flight
{
public:
    int FlightTypeIdentify(int flightAction, string departLocation, string destination_1, string destination_2);
    void NotflightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string DeLocation, string dest_1, string dest_2,int Type, string AirType, string PSizeType);
    void flightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string PSizeType, string DeLocation, string dest_1, string dest_2, string AirType);
    int flightType;
    set<string> domestic_name;
    set<string>::iterator set_iter, set_iter1, set_iter2;
    string flightNumber;
    int flightAction;
    int expectTime;
    string regNumber;
    int planeSize;
    string departLocation;
    string destination_1;
    string destination_2;
    string AirCraftType;
    string PlaneSizeType;
    flight();
    virtual ~flight();

};

#endif

and here is my flight.cpp
include "stdafx.h"
#include "flight.h"

#include <string>
using std::string;



//#ifdef _DEBUG
//#undef THIS_FILE
//static char THIS_FILE[]=__FILE__;
//#define new DEBUG_NEW
//#endif


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

flight::flight()
{
    domestic_name.insert("AOR");
    domestic_name.insert("BKI");
    domestic_name.insert("BTU");
    domestic_name.insert("IPH");
    domestic_name.insert("JHB");
    domestic_name.insert("KBR");
    domestic_name.insert("KCH");
    domestic_name.insert("KUA");
    domestic_name.insert("KUL");
    domestic_name.insert("LBU");
    domestic_name.insert("LDU");
    domestic_name.insert("LGK");
    domestic_name.insert("MYY");
    domestic_name.insert("PEN");
    domestic_name.insert("SBW");
    domestic_name.insert("SDK");
    domestic_name.insert("TGG");
    domestic_name.insert("TWU");
}

flight::~flight()
{

}

void flight::flightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string PSizeType, string DeLocation, string dest_1, string dest_2, string AirType)
{
    flightNumber = FNumber;
    flightAction = FAction;
    expectTime = ExTime;
    regNumber = RegNumber;
    planeSize = PSize;
    departLocation = DeLocation;
    destination_1 = dest_1;
    destination_2 = dest_2;
    AirCraftType = AirType;
    flightType = FlightTypeIdentify(flightAction,departLocation,des tination_1,destination_2);
    PlaneSizeType = PSizeType;

}

void flight::NotflightData(string FNumber, int FAction, int ExTime, string RegNumber, int PSize, string DeLocation, string dest_1, string dest_2, int Type, string AirType, string PSizeType)
{
    flightNumber = FNumber;
    flightAction = FAction;
    expectTime = ExTime;
    regNumber = RegNumber;
    planeSize = PSize;
    departLocation = DeLocation;
    destination_1 = dest_1;
    destination_2 = dest_2;
    flightType = Type;
    AirCraftType = AirType;
    PlaneSizeType = PSizeType;
}

int flight::FlightTypeIdentify(int flightAction, string departLocation, string destination_1, string destination_2)
{
    if (destination_2.empty()) //it is direct flight
    {
        if (flightAction) //if it is departure
        {
            set_iter = domestic_name.find(destination_1);
            if ( set_iter!=domestic_name.end() )
            {
                return true; //domestic
            }
            else
            {
                return false; //international
            }
        }
        else //if it is arrival
        {
            set_iter = domestic_name.find(departLocation);
            if ( set_iter!=domestic_name.end() )
            {
                return true; //domestic
            }
            else
            {
                return false; //international
            }
        }
    }
    else //indirect flight
    {
        set_iter = domestic_name.find(destination_1);
        set_iter1 = domestic_name.find(destination_2);
        set_iter2 = domestic_name.find(departLocation);
        if ( set_iter!=domestic_name.end() && set_iter1 != domestic_name.end() && set_iter2!=domestic_name.end())
        {
            return true; //domestic
        }
        else
        {
            return false; //international
        }
    }

}
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2143: syntax error : missing ';' before '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2501: 'set' : missing storage-class or type specifiers
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2059: syntax error : '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(23) : error C2238: unexpected token(s) preceding ';'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2143: syntax error : missing ';' before '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2501: 'set' : missing storage-class or type specifiers
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2059: syntax error : '<'
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2039: 'iterator' : is not a member of '`global namespace''
c:\documents and settings\yong\desktop\copy of flight\flight.h(24) : error C2238: unexpected token(s) preceding ';'
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(26) : error C2065: 'domestic_name' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(26) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(27) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(28) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(29) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(30) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(31) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(32) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(33) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(34) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(35) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(36) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(37) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(38) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(39) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(40) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(41) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(42) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(43) : error C2228: left of '.insert' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(88) : error C2065: 'set_iter' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(88) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(89) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(100) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(101) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(113) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(114) : error C2065: 'set_iter1' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(114) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(115) : error C2065: 'set_iter2' : undeclared identifier
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(115) : error C2228: left of '.find' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
C:\Documents and Settings\yong\Desktop\Copy of flight\flight.cpp(116) : error C2228: left of '.end' must have class/struct/union type
Error executing cl.exe.

 
Old March 21st, 2008, 11:40 PM
Authorized User
 
Join Date: Mar 2008
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

it must be some system problems in your code judged by the information of errors.the errors should be very little,you correct one place and all the errors would disappear.

fight now,date in future.
 
Old March 22nd, 2008, 10:38 PM
Registered User
 
Join Date: Mar 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cupido Send a message via Yahoo to cupido
Default

Actually, my project is in .dll project and i have to convert it back to .exe to check the output but I don't know how to do that. So, I take one part of the code to try it first.
So, can you help me please..I really don't know how to do it..So sad.. :(






Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does it show Link error 2001? Jams Visual C++ 2 July 10th, 2007 05:15 AM
show an error if not checked aku_hardy PHP How-To 1 June 6th, 2007 05:07 AM
With Me .Show() I get error "end of statement exp kenn_rosie VS.NET 2002/2003 1 March 20th, 2006 09:12 PM
Why does the SQL show error? gilgalbiblewheel Classic ASP Databases 11 October 18th, 2004 07:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.