|
-
Aug 9th, 2002, 04:06 PM
#1
Thread Starter
Ya ya Baby!!!Me is Back
oo problem
Ok here is the problem in a cpp file :
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
Header:
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.
-
Aug 9th, 2002, 04:18 PM
#2
New Member
Wow, that's a tough one.
Geez....I don't know.
-
Aug 9th, 2002, 04:25 PM
#3
-
Aug 9th, 2002, 04:28 PM
#4
Monday Morning Lunatic
You must have missed adding Menu.cpp to your project...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 9th, 2002, 05:04 PM
#5
Thread Starter
Ya ya Baby!!!Me is Back
I found it!
The error was that I got 2 function with the same name, one in menu and one in submenu. Now I changed that and all worked well.
I think I need to watchout about overloading function and go read back some note but now it works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|