Ok here is the problem in a cpp file :
Header:PHP Code:
#include "barreprinc.h"
void BarrePrinc::AddMenu(string sNameMenu)
{
//Put the new menu in the vector
vMenuList.push_back(Menu(sNameMenu));
//Ajust the size of the menu that we have
SetLen(GetLen() - sNameMenu.length());
}//End BarrePrinc::AddMenu
void BarrePrinc::AddSubMenu(string sNameMenu, string sNameSubMenu)
{
for (int i = 0; i < vMenuList.size(); i++)
{
if (vMenuList[i].GetMenuName() == sNameMenu)
{
vMenuList[i].AddSubMenu(sNameSubMenu);
}//End if
}//End for : i
}//End BarrePrinc::AddSubMenu
PHP Code:#include <string>
#include <vector>
#include "menu.h"
using namespace std;
class BarrePrinc
{
private:
//Hold empty space in the bar
unsigned short int iBarLen;
//Contain all Menu in this vector
vector<Menu> vMenuList;
//Change the empty space that the bar can hold
void SetLen(unsigned short int iLen){iBarLen = iLen;}
unsigned short int GetLen(){return iBarLen;}
public:
//Constructor
BarrePrinc():iBarLen(80){};
//Functions
void AddMenu(string sNameMenu);
void AddSubMenu(string sNameMenu, string sNameSubMenu);
};//End class : BarrePrinc
Why I got that error :
Compiling...
barrePrinc.cpp
main.cpp
Linking...
barrePrinc.obj : error LNK2001: unresolved external symbol "public: void __thiscall Menu::AddSubMenu(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?AddSubMenu@Menu@@QAEXV?$basic_string@DU?$char_traits@D@s
td@@V?$allocator@D@2@@std@@@Z)
Debug/MyFirstMenuInDos.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.




Reply With Quote