error C2511 : overloaded member function not found in Class
c++, enums, overloading, visual-studio-2010
Solution
The `enum sortType` is defined in `Journey.h`
however, is not visible in `menu.h` and you are using `enum sortType` as input argument in the declaration of member function `Menus::sortListBy(sortType,Vector<connections>);` in the definition of the `Menus` class.
In `Menus.h` remove the forward declaration of `class Journey;` and replace it with `#include "Journey.h"`.
Remove `#include "Menus.h"` in `Journey.h`.
There should be no problem, since you don't have circular dependency issues between `Journey` and `Menus`.
Problem
This is the error im recieving. ``` Error 4 error C2511: 'Vector<T> Menus::sortListBy(sortType,Vector<T>)' : overloaded member function not found in 'Menus' z:\documents\visual studio 2010\projects\oo_cw\oo_cw\menus.cpp 410 1 OO_CW ``` I believe this is something to do with me trying to use an enum that is included in a header but doesnt seem to be carried over to the other classes. Here are the 2 headers involved and the function im struggling with:: Menus.cpp: ``` Vector<connections> Menus::sortListBy(sortType sortKey,Vector<connections> sortList){} ``` Menus.h ``` #pragma once #include "std_lib_facilities.h" #include "Airport.h" class Journey; #include <string> typedef enum {BACK,FORWARD,INVALID,OPTIONS} result; typedef enum {BOOK,VIEW,EXIT} firstChoice; class Menus { public: Menus(void); ~Menus(void); firstChoice firstMenu(); Airport bookingMenuFirst(Vector<Airport>); Airport bookingMenuSecond(Vector<connections>,Vector<Airport>); airlines bookingMenuThird(Airport,Airport,Journey&); string bookingMenuDate(); bool showReciept(string,string,string,string,double,double,double); string showRecieptNames(); void readReciept(string); void optionMenu(Journey); Vector<connections> sortListBy(sortType,Vector<connections>); }; ``` Journey.h ``` #pragma once #include "std_lib_facilities.h" #include "Airport.h" #include <string> #include "Menus.h" enum sortType {PRICE,TIME} ; class Journey { public: Journey(void); ~Journey(void); //accessors Airport getStart(); Airport getEnd(); string getDate(); airlines getAirline(); string getStringAirline(); double getTime(); double getPrice(); sortType getSort(); //modifiers void setStart(Airport); void setEnd(Airport); void setPrice(double); void setTime(double); void setAirline(airlines); void setDate(string); void saveBooking(); void setSort(sortType); private: Airport startAirport; Airport endAirport; double price; double time; string date; airlines airline; Vector<string> splitBy(string,string); sortType sortingBy; }; ``` Menus.cpp header statements ``` #include "Menus.h" #include "std_lib_facilities.h" #include "Airport.h" #include "Journey.h" #include <string> using namespace std; ```