Defining a default constuctor outside the class.

I'm having trouble defining a default constructor and destructor outside of the class. When i put TicketManager(); and ~TicketManager(); inside of the class as prototypes, it gives me a void _thisfunctioncall error. When I don't put them, it compiles fine but does not give any output when the object is created. here is my code, they are three seperate files.

TicketManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 #ifndef TICKETMANAGER_H
#define TICKETMANAGER_H
using namespace std;

class TicketManager
{
	struct SeatStructures 				//Create a structure that contains the price of a seat and the seat's availability.
	{
		double price;
		char avail;
	};
	
	public:

	private:
	
	const static int rows = 0,			//Counter variables for the loops.
					 cols = 0;
	const static int S_ROWS = 15,       //Holds the values for the number of rows and columns.
					 S_COLS = 30;
	SeatStructures SeatChart[S_ROWS][S_COLS];
};

#endif 



TicketManager.cpp
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 <fstream>
#include "TicketManager.h";
using namespace std;

TickerManager::TicketManager()				//TicketManager constructor.
{
	ifstream seatPrices,
			 seatAvailability;
			 
	cout << "A Ticket Manager object is being created.\n";
	
	seatPrices.open("seatPrices.dat");
	seatPrices.close();
	
	cout << rows << cols;
}

TicketManager::~TicketManager()
{
	cout << "Destructed.";
}


Project.cpp
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>
#include "TicketManager.h"
using namespace std;

int main()
{
	TicketManager newTicket;
	
	newTicket;
	
	return 0;
}
It's supposed to look like this:
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
 #ifndef TICKETMANAGER_H
#define TICKETMANAGER_H
using namespace std;

class TicketManager
{
	struct SeatStructures 				//Create a structure that contains the price of a seat and the seat's availability.
	{
		double price;
		char avail;
	};
	
	public:
	TicketManager();
	~TicketManager();

	private:
	
	const static int rows = 0,			//Counter variables for the loops.
					 cols = 0;
	const static int S_ROWS = 15,       //Holds the values for the number of rows and columns.
					 S_COLS = 30;
	SeatStructures SeatChart[S_ROWS][S_COLS];
};

#endif 
You get errors with this?
Yes, here's the compiler error.

project.obj : error LNK2019: unresolved external symbol "public _thiscall TicketManager::~TicketManager(void)" (!!1TicketManager@@AE@XZ) referenced in function _main

project.obj : error LNK2019: unresolved external symbol "public: _thiscall TicketManager::TicketManager(void)" (??0TicketManager@@QA@XZ) referenced in function _main

project.exe : fatal error LNK1120: 2 unresolved externals
Are you sure all your object files are linking together in the same project?
This is a linker error. You must include both Project.obj and TicketManager.obj while linking the executable.
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.. see... I was only trying to compile the main program. I guess I should've read that section on making seperate files. I'm so happy I could cry. Thanks guys... I'm so happy. Sad thing is, I probably would've never figured that one out.
Topic archived. No new replies allowed.