I have written the following code that I will post below. Each time I try to compile it I receive the following error.

1>main.obj : error LNK2001: unresolved external symbol "public: __thiscall OrderSet::OrderSet(void)" (??0OrderSet@@QAE@XZ)
1>C:\Users\Bill\Desktop\School1\c++\c++ spring cs2\program2\Debug\program2.exe : fatal error LNK1120: 1 unresolved externals

Note I am using Visual Studios C++ Express Edition 2008 I don't know if there is a problem with my code or something has happened in the compiler itself.

Code Below:

orderset.h

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

struct List{

	int data;

	List *next;

};   // end of struct

class OrderSet{

public:

	OrderSet();   // default constructor
	OrderSet(OrderSet &data);   // copy constructor
	~OrderSet();   // de-constructor

	// Member functions

	OrderSet union1();
	OrderSet intersection();
	OrderSet find();
	OrderSet add();
	OrderSet test();
	OrderSet getADTA();
	OrderSet getADTB();
	OrderSet showADTA();
	OrderSet showADTB();
	void mainMenu();

private:

	List a;
	List b;

};   // end of class

*************************************
main.cpp

#include "orderset.h"

int main()
{
	OrderSet m;

	m.mainMenu();

	return 0;

}   // end of main

*************************************
orderset.cpp

#include "orderset.h"

OrderSet::~OrderSet()
{
}   // end of de-constructor

//======================================

void OrderSet::mainMenu(){

	cout << "i am the main menu" << endl;

}

************************************

where is the implementation code for that constructor?

BTW: it is almost never ever the fault of the compiler.

Oh I forgot the constructor part

OrderSet::OrderSet()
{
}   // end of constructor

I put that in an it works fine now thank you for reminding me about that. No I did not think it was the compiler the only reason I suggested that was because this code was working fine when I built it in the lab this afternoon and I just opened it up on my laptop and I got the error so I wasn't sure really what was going on.

That is one reason I like to use inline methods in the header file then they are small enough.

struct List{

	int data;
	List *next;
};   // end of struct

class OrderSet{

public:

    // default constructor
    OrderSet()
    {
    }
    // copy constructor
    OrderSet(OrderSet &data)
    {

    }
    // de-constructor
    ~OrderSet()   
   {
   }

	// Member functions

	OrderSet union1();
	OrderSet intersection();
	OrderSet find();
	OrderSet add();
	OrderSet test();
	OrderSet getADTA();
	OrderSet getADTB();
	OrderSet showADTA();
	OrderSet showADTB();
	void mainMenu();

private:

	List a;
	List b;

};   // end of class

Yes I think I will start doing that from now on if they are small enough. Thank you again for you help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.