Error C2660

Pages: 12
Hello Everyone,
New here and new to C++. When I try to compile my function, I get the error "error C2660: function does not take 6 arguments." No matter what I try, I can't figure out what to do with it. Any help is greatly appreciated. Thanks so much!

This is my .h file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  #pragma once
#include <string>
using namespace std;

class Flight
{
private: 
	int flight;
	string city;
	string time;
	string gate;
	int month;
	int date;
	
public:
	Flight(void);
	~Flight(void);
	Flight(int setFlight, string setDestinationCity, string setDepartureTime, string setDepartureGate, int setDepartureMonth, int setDepartureDate);
	void setFlight(int flight);
	void setDestinationCity(string city);
	void setDepartureTime(string time);
	void setDepartureGate(string gate);
	void setDepartureMonth(int month);
	void setDepartureDate(int date);

	int getMonth();
	int getDate();

	void set();

	void show();

};


This is my .cpp file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;

Flight::Flight(void)
{
}

Flight::~Flight(void)
{
}


Flight::Flight(int setFlight, string setDestinationCity, string setDepartureTime, string setDepartureGate, int setDepartureMonth, int setDepartureDate):
	flight(flight),
	city(city),
	time(time),
	gate(gate),
	month(month),
	date(date) {;
	}




void Flight::setFlight(int flight) {
	this->flight = flight; 
}

void Flight::setDestinationCity(string city) {
	this->city = city;
}

void Flight::setDepartureTime(string time) {
	this->time = time;
}

void Flight::setDepartureGate(string gate) {
	this->gate = gate;
}

void Flight::setDepartureMonth(int month) {
	this->month = month;
}

void Flight::setDepartureDate(int date) {
	this->date = date;
}

int Flight::getMonth() {
	return month;
}

int Flight::getDate() {
	return date;
}

void Flight::show() {

	cout << "Flight " << flight << " for " << city << " leaving at " << time << " from gate " << gate << endl; 
}


Finally, this is my main file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;

void runTravel() {
	Flight leg[3];
	// flight #, destination, departure time, gate, month, date
	leg[0].set(225, "Rome", "8:00 am", "B12", 4, 21);
	leg[1].set(16, "Vienna", "11:30 am", "A5", 4, 21);
	leg[2].set(27, "Moscow", "4:15 pm", "C9", 4, 21);
	cout << "Here is your itinerary beginning on "
		<< leg[0].getMonth() << "/" << leg [0].getDate() << ":\n";
	for (int i = 0; i < 3; i++)
		leg[i].show();
	//Flight 225 for Rome leaving at 8:00 am from gate B12.
}

int main() {
	runTravel();
	return 0;
}


The error is specifically referencing the "225," "16," & "27" in the code below:

1
2
3
        leg[0].set(225, "Rome", "8:00 am", "B12", 4, 21);
	leg[1].set(16, "Vienna", "11:30 am", "A5", 4, 21);
	leg[2].set(27, "Moscow", "4:15 pm", "C9", 4, 21)


Thanks so much for any help!
Declared in your class:
void set();

As you can see, set takes 0 arguments, so your compiler is correct. Flight::set does not take 6 arguments. You also didn't define Flight::set anywhere in your code.
I defined Flight::set by writing:

int Flight::set; in my .h file. When I do that, however, I get another error now telling me that the leg[] is not evaluating a function. I'm not sure where to go from there though.
Hi Everyone,

I'm still confused on where I am going wrong in my code. I know that something is off, but I can't figure out where.

Here is my .h file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once
#include <string>
using namespace std;

class Flight
{
private: 
	int number;
	string city;
	string time;
	string gate;
	int month;
	int date;
	
public:
	Flight(void);
	~Flight(void);
	Flight(int setNumber, string setDestinationCity, string setDepartureTime, string setDepartureGate, int setDepartureMonth, int setDepartureDate);
	void setNumber(int number);
	void setDestinationCity(string city);
	void setDepartureTime(string time);
	void setDepartureGate(string gate);
	void setDepartureMonth(int month);
	void setDepartureDate(int date);

	int getMonth();
	int getDate();

	void show();
	void set();

};



Here is my .cpp file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;

Flight::Flight(void)
{
}

Flight::~Flight(void)
{
}


Flight::leg(int setNumber, string setDestinationCity, string setDepartureTime, string setDepartureGate, int setDepartureMonth, int setDepartureDate):
	number(number),
	city(city),
	time(time),
	gate(gate),
	month(month),
	date(date) {;
	}


void Flight::setNumber(int number) {
	this->number = number; 
}

void Flight::setDestinationCity(string city) {
	this->city = city;
}

void Flight::setDepartureTime(string time) {
	this->time = time;
}

void Flight::setDepartureGate(string gate) {
	this->gate = gate;
}

void Flight::setDepartureMonth(int month) {
	this->month = month;
}

void Flight::setDepartureDate(int date) {
	this->date = date;
}

int Flight::getMonth() {
	return month;
}

int Flight::getDate() {
	return date;
}

void Flight::show() {

	cout << "Flight " << number << " for " << city << " leaving at " << time << " from gate " << gate << endl; 
}



Here is my main:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;

void runTravel() {
	Flight leg[3];
	// flight #, destination, departure time, gate, month, date
	leg[0].set(225, "Rome", "8:00 am", "B12", 4, 21);
	leg[1].set(16, "Vienna", "11:30 am", "A5", 4, 21);
	leg[2].set(27, "Moscow", "4:15 pm", "C9", 4, 21);
	cout << "Here is your itinerary beginning on "
		<< leg[0].getMonth() << "/" << leg [0].getDate() << ":\n";
	for (int i = 0; i < 3; i++)
		leg[i].show();
	//Flight 225 for Rome leaving at 8:00 am from gate B12.
}

int main() {
	runTravel();
	return 0;
}


These are the errors that I am getting:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

1
1>  Sops_15.cpp
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(9): error C2660: 'Flight::set' : function does not take 6 arguments
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(10): error C2660: 'Flight::set' : function does not take 6 arguments
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(11): error C2660: 'Flight::set' : function does not take 6 arguments
1>  Flight.cpp
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(15): error C2039: 'leg' : is not a member of 'Flight'
1>          c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.h(6) : see declaration of 'Flight'
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(15): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(16): error C2065: 'number' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(17): error C2065: 'city' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(18): error C2065: 'time' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(19): error C2065: 'gate' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(20): error C2065: 'month' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(21): error C2065: 'date' : undeclared identifier
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(21): error C2550: 'leg' : constructor initializer lists are only allowed on constructor definitions
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(22): warning C4508: 'leg' : function should return a value; 'void' return type assumed
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Again, I know that I am definitely going wrong somewhere, but I just can't figure it out. Any help would be greatly appreciated. Thanks so much!
Basically you have a void set();
and you are trying to MAKE SOMETHING OUT OF IMMAGINATION xD

you are calling void set(arg1, arg2, arg3, arg4, arg5, arg6) but that function does not exist.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include <string>
using namespace std;

class Flight
{
private: 
	int number;
	string city;
	string time;
	string gate;
	int month;
	int date;
	
public:
	Flight(void);
	~Flight(void);
	Flight(int setNumber, string setDestinationCity, string setDepartureTime, string setDepartureGate, int setDepartureMonth, int setDepartureDate);
	void setNumber(int number);
	void setDestinationCity(string city);
	void setDepartureTime(string time);
	void setDepartureGate(string gate);
	void setDepartureMonth(int month);
	void setDepartureDate(int date);

	int getMonth();
	int getDate();

	void show();
	void set(); // HERE

};

[code]
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;


//set is defined as void set(); without arguments, also there is none in your .cpp
void runTravel() {
	Flight leg[3];
	// flight #, destination, departure time, gate, month, date
	leg[0].set(225, "Rome", "8:00 am", "B12", 4, 21);
	leg[1].set(16, "Vienna", "11:30 am", "A5", 4, 21);
	leg[2].set(27, "Moscow", "4:15 pm", "C9", 4, 21);
	cout << "Here is your itinerary beginning on "
		<< leg[0].getMonth() << "/" << leg [0].getDate() << ":\n";
	for (int i = 0; i < 3; i++)
		leg[i].show();
	//Flight 225 for Rome leaving at 8:00 am from gate B12.
}

int main() {
	runTravel();
	return 0;
}


Basically you are trying to do this:
1
2
3
4
5
6
7
8
9
Flight::set(int a, string b, string c, string d, int e ,int f)
{
        setNumber(a);
	setDestinationCity(b);
	setDepartureTime(c);
	setDepartureGate(d);
	setDepartureMonth(e);
	setDepartureDate(f);
}

As written in many books.
Last edited on
Thank you for the response! I think I understand what to do now, but I'm still slightly confused. What would I do with the set in the .h file? I assume it has to be referenced there somehow? Also, around line 15 of the .cpp file above, I use Flight::leg(). Should I change that to set, or do I still need to also mention "leg" at some point in the code?

Thank you again for the help!
I think you need to start from the basis first.
and yes

As a beginner you could consider a Class as a more perfect Structure.

A class is basically a TEMPLATE when you have things that you already know it will use(Sorry my english is broken at this time).

For Exemple:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//MyClass.h
class MyClass
{
public:
    MyClass() //Constructor;
    void MyFunction(int, int, float, double); //This is just a declaration of a function, so is just declared.
};
//MyClass.cpp
void MyClass::MyFunction(int number1, int idk, float anotherNumber, double ilovenumbers)
{
    //code
    /*
    Basically here you are defining your function
    See the parameters, have a name.
    This must be EQUAL to an already declared function.
    */
}


Also, around line 15 of the .cpp file above, I use Flight::leg(). Should I change that to set, or do I still need to also mention "leg" at some point in the code?

Yes, i don't know why is called leg (O_o) also, leg() seem more like a constructor, you should call it Flight, so should be Flight::Flight(string, string, ecc). C++ has overload.
If you don't know what a constructor is, is basically what is created when the object is created.

Then in the main the object can be called whatever you want
like
 
Flight ajisduhaisdu[3]
Last edited on
@dsopshin

OK, I think you need some major reorganisation of your code, some overall points:

1. Naming of variables is confusing;
2. No need for get / set functions.

1. Variable names

The name leg is confusing, In my mind you ought to have the concept of a Route being a collection of Flights. But you have called the collection a leg. A std::vector might be better than an array for this. So try :

std::vector<TRS::Flight>Route; // A vector of Flight objects named Route

see below for the namespace explanation.

Using a vector means you can std::push_back items into the vector.

http://www.cplusplus.com/reference/vector/vector/
http://www.cplusplus.com/reference/vector/vector/push_back/


2. No need for get / set functions

There is no need to have a get / set function for each member variable.

We had a huge discussion about that here :

http://www.cplusplus.com/forum/lounge/101305/


Get functions are only needed when access to an objects members is needed outside the class, and the same functionality cannot be achieved with a member function.

Instead of set functions, you can make use of constructors with initialiser lists. But first the class declaration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include <string>
using namespace std;


// Travel Reservation System namespace
namespace TRS {
class Flight
{
private: 
	std::string m_FlightNumber; // a string because we are not doing any math with it
	std::string m_DestinationCity;
 	std::string m_DepartureTime;
 	std::string m_DepartureGate;
	unsigned int m_DepartureMonth;
	unsigned int m_DepartureDay;
	
public:
	Flight();
	
        Flight(std::string FlightNumber, std::string DestinationCity, std::string DepartureTime, 
                      std::string setDepartureGate, unsigned int DepartureMonth, unsigned int DepartureDay);
        ~Flight();

	void setNumber(int number);
	void setDestinationCity(string city);
	void setDepartureTime(string time);
	void setDepartureGate(string gate);
	void setDepartureMonth(int month);
	void setDepartureDate(int date);

	int getMonth();
	int getDate();

	void show();
        void DisplayDetails();
	void set();
        void Display MonthDay();

}; // end of Flight class
}  // end of TRS namespace


Now the initialiser list :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

namespace TRS {
Flight::Flight(std::string FlightNumber, std::string DestinationCity, std::string DepartureTime, 
                      std::string DepartureGate, int DepartureMonth, int DepartureDay) : // start initialiser list
                  m_FlightNumber(FlightNumber),
                  m_DestinationCity(DestinationCity),
                  m_DepartureTime(DepartureTime),
                  m_DepartureGate(DepartureGate),
                  m_DepartureMonth(DepartureMonth),
                  m_DepartureDay(DepartureDay)
                  {}

void Flight::DisplayDetails() {
std::cout << "Flight " << m_FlightNumber << " for " <<  m_DestinationCity << " leaving at "; 
std::cout << m_DepartureTime << " from gate " << m_DepartureGate << std::endl;
}

void Display MonthDay() {
std::cout << "Here is your itinerary beginning on "
		<< m_DepartureMonth() << "/" << DepartureDay() << ":\n";
}

}  // end of TRS namespace 


Now, in main, you can build an object using it's constructor, then call the object's functions. This idea is part of what is called encapsulation: Generally all the functions & data for an object are within the objects class.

A further point: Remember that a class function has direct access to member variables, so there is no need to use the this operator, just refer to them directly. The this operator is handy for operator overloading.

As you can see, I got rid of the using namespace std; and added a new namespace. The std namespace is huge, bringing it into the global namespace pollutes it, and runs the risk of variable & function naming conflict, which is the whole point of using a namespace! Did you know that there are std::distance, std::left, std::right, just to name a few? So it is best to put your own classes into your own namespace(s). To refer to something in a namespace, pecede it with the name of the namespace and the scope resolution operator, like this :

std::cout

std::vector<TRS::Flight>Route; // A vector of Flight objects named Route

So in summary, if you do all these things, you will have much less & better code, and might even get better marks for your assignment.

I look forward to seeing how you go 8+)


Last edited on
@TheIdeasMan

Thank you for the suggestion. As part of my class, however, my teacher wants us to use the sets & gets, as well as "namespace std." Here is what I currently have (I tried to implement some of your thoughts as well, but I am still having issues):

.h file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <string>
using namespace std;

class Flight
{
private: 
	string set();
	string FlightNumber;
	string DestinationCity;
	string DepartureTime;
	string DepartureGate;
	string DepartureMonth;
	string DepartureDate;

	
public:
	Flight(void);
	Flight(string setNumber, string setDestinationCity, string setDepartureTime, string setDepartureGate, string setDepartureMonth, string setDepartureDate);
	~Flight(void);
	

	string getDepartureMonth();
	string getDepartureDate();

	void show();

};


My .cpp file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;



Flight::Flight(void)
{
}

Flight::~Flight(void)
{
}

Flight::Flight(string setFlightNumber, string setDestinationCity, string setDepartureTime, string setDepartureGate, string setDepartureMonth, string setDepartureDate):
	FlightNumber(setFlightNumber),
	DestinationCity(setDestinationCity),
	DepartureTime(setDepartureTime),
	DepartureGate(setDepartureGate),
	DepartureMonth(setDepartureMonth),
	DepartureDate(setDepartureDate)
	{}	


string Flight::getDepartureMonth() {
	return DepartureMonth;
}

string Flight::getDepartureDate() {
	return DepartureDate;
}

void Flight::show() {

	cout << "Flight " << FlightNumber << " for " << DestinationCity << " leaving at " << DepartureTime << " from gate " << DepartureGate << endl; 
}
   


My main:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
#include <string>
#include "Flight.h"
using namespace std;

void runTravel() {
	Flight leg[3];
	// flight #, destination, departure time, gate, month, date
	leg[0].set(225, "Rome", "8:00 am", "B12", 4, 21);
	leg[1].set(16, "Vienna", "11:30 am", "A5", 4, 21);
	leg[2].set(27, "Moscow", "4:15 pm", "C9", 4, 21);
	cout << "Here is your itinerary beginning on "
		<< leg[0].getMonth() << "/" << leg [0].getDate() << ":\n";
	for (int i = 0; i < 3; i++)
		leg[i].show();
	//Flight 225 for Rome leaving at 8:00 am from gate B12.
}

int main() {
	runTravel();
	return 0;
}


Now I am getting these errors:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
1
1>  Sops_15.cpp
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(9): error C2664: 'int Flight::set(int,std::string,std::string,std::string,std::string,std::string)' : cannot convert parameter 5 from 'int' to 'std::string'
1>          No constructor could take the source type, or constructor overload resolution was ambiguous
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(10): error C2664: 'int Flight::set(int,std::string,std::string,std::string,std::string,std::string)' : cannot convert parameter 5 from 'int' to 'std::string'
1>          No constructor could take the source type, or constructor overload resolution was ambiguous
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(11): error C2664: 'int Flight::set(int,std::string,std::string,std::string,std::string,std::string)' : cannot convert parameter 5 from 'int' to 'std::string'
1>          No constructor could take the source type, or constructor overload resolution was ambiguous
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(13): error C2039: 'getMonth' : is not a member of 'Flight'
1>          c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.h(6) : see declaration of 'Flight'
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\sops_15.cpp(13): error C2039: 'getDate' : is not a member of 'Flight'
1>          c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.h(6) : see declaration of 'Flight'
1>  Flight.cpp
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(16): error C2511: 'Flight::Flight(std::string,std::string,std::string,std::string,std::string,std::string)' : overloaded member function not found in 'Flight'
1>          c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.h(6) : see declaration of 'Flight'
1>c:\users\david sopshin\documents\visual studio 2010\projects\sops_15\flight.cpp(40): fatal error C1004: unexpected end-of-file found
1>  Generating Code...
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Thank you again for your help. I really appreciate it.
dsopshin wrote:
Thank you for the suggestion. As part of my class, however, my teacher wants us to use the sets & gets, as well as "namespace std."


Are you really sure? Did the assignment actually explicitly say that? If so then that is really a shame.

Get functions are not so bad (when they are actually needed), but naive (straight assignment) set functions are terrible:

1
2
dsopshin.setAcctBalance(-1000000.00);  // instant mortgage 1 million dollars
TheIdeasMan.setAcctBalance(100000000.00); // woo hoo 100 million bucks!! , same tmrw I think !! 


And realise that having public get / set functions for every member variable is just the same as making them all public !!

Having a get function just for the purpose of printing the value of a member variable in main() is poor style, that's why I mentioned having it in a member function.

The other thing is to have Update functions if the value of a member variable is to change after the object has been constructed. These functions should have validation or checking code in them.

The problem is that teachers explain how having private variables is a good idea (and it is), but then they don't explain how to do it properly.

It would be interesting if you were to show my posts to your teacher - see what s/he says?

Did you notice I renamed your variables to make them easier to understand? Notice the m_ before all the member variables?

Now for your errors :

cannot convert parameter 5 from 'int' to 'std::string'


send "1" as an argument instead of 1.

error C2039: 'getMonth' : is not a member of 'Flight'


Just that - there is no declaration of getMonth in the Flight class.

overloaded member function not found in 'Flight'


The compiler did not find an overloaded version of this function. That is a version of the function with those parameter types. Function overloading works by having differing numbers & types or const-ness of parameters for functions with the same name.

fatal error C1004: unexpected end-of-file found


Missing a closing brace at the end of your last function?

What compiler are you using?
@toad1359

The errors show that VS2010 is being used. AFAIK it has it's own compiler.
I have just spotted this:

The error message mentions the file flight.h but the include statement has it as "Flight.h"
¿Is windows case sensitive?

Still http://www.cplusplus.com/forum/beginner/107904/#msg585863
(except that now returns an std::string, and it is private)

@OP: imagine that you are the compiler and try to read your code, put in comment what you think each line does,
see if it makes sense
I feel like I am very very close right now. Right now my only error is:

 
error C2550: 'set' : constructor initializer lists are only allowed on constructor definitions


But anytime I try to move the initializer list to anywhere else, I get additional errors. Thanks again for the help!
¿Is windows case sensitive?

The Windows file system is not case-sensitive with regard to file names. So it sees "flight.h" as the same as "Flight.h", "FLIGHT.H" and "fLiGhT.h".

This can be an enormous headache when trying to port from Windows to another OS.

I feel like I am very very close right now. Right now my only error is:

 
error C2550: 'set' : constructor initializer lists are only allowed on constructor definitions

But anytime I try to move the initializer list to anywhere else, I get additional errors. Thanks again for the help!

I don't see the definition of the set() method anywhere in the code you've posted.

Regardless, the compiler is correct: a constructor is the only place you can have an initialisation list.

EDIT: You can, however, simply assign values to your data members in the normal way, in any non-const method.
Last edited on
So where would I put a set()? I don't think I know where to put it.
What do you mean, where would you put it? You've already declared it as a method of your class. You've already shown that you know how to define methods on your class. Why is this one puzzling you?
I'm not sure. It seems like everything I try is causing new errors to appear.
So it seems like that might be resolved, but I am now getting this error:

1
2
3
4
5
1
1>  Sops_15.cpp
1>Sops_15.obj : error LNK2019: unresolved external symbol "public: int __thiscall Flight::set(int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int)" (?set@Flight@@QAEHHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@00HH@Z) referenced in function "void __cdecl runTravel(void)" (?runTravel@@YAXXZ)
1>C:\Users\David Sopshin\Documents\Visual Studio 2010\Projects\Sops_15\Debug\Sops_15.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Where could this be coming from, and what wouldI have done to cause it?
Pages: 12