Click here to Skip to main content
15,914,419 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalresize child frame window Pin
Anonymous25-Dec-04 14:50
Anonymous25-Dec-04 14:50 
GeneralQuestion Regarding ToolBarwindow32 Pin
sdssd25-Dec-04 11:44
sdssd25-Dec-04 11:44 
QuestionBelieve in yourself? Pin
Anonymous25-Dec-04 10:53
Anonymous25-Dec-04 10:53 
AnswerRe: Believe in yourself? Pin
alex.barylski25-Dec-04 14:45
alex.barylski25-Dec-04 14:45 
GeneralRe: Believe in yourself? Pin
John R. Shaw26-Dec-04 12:59
John R. Shaw26-Dec-04 12:59 
AnswerRe: Believe in yourself? Pin
Henry miller27-Dec-04 3:45
Henry miller27-Dec-04 3:45 
Generalm_pMainWnd in a multi-dialog based app Pin
Penguen Efendi25-Dec-04 10:14
Penguen Efendi25-Dec-04 10:14 
QuestionWhat is wrong with this template? Pin
sacoskun25-Dec-04 8:32
sacoskun25-Dec-04 8:32 
StackA.h

#ifndef STACKA_H<br />
#define STACKA_H<br />
// *********************************************************<br />
// Header file StackA.h for the ADT stack.<br />
// Array-based implementation.<br />
// *********************************************************<br />
#include "StackException.h"<br />
#include <new><br />
const int MAX_STACK = 100;<br />
<br />
template < class StackItemType ><br />
<br />
class Stack<br />
{<br />
public:<br />
// constructors and destructor:<br />
   Stack();  // default constructor<br />
<br />
// stack operations:<br />
   bool isEmpty() const;<br />
   void push(StackItemType newItem) throw(StackException);<br />
   void pop() throw(StackException);<br />
   void pop(StackItemType& stackTop) throw(StackException);<br />
   void getTop(StackItemType& stackTop) const<br />
           throw(StackException);<br />
<br />
private:<br />
   StackItemType items[MAX_STACK];  // array of stack items<br />
   int           top;               // index to top of stack<br />
};  // end class<br />
<br />
#endif


StackA.cpp

// *********************************************************<br />
// Implementation file StackA.cpp for the ADT stack.<br />
// Array-based implementation.<br />
// *********************************************************<br />
#include "StackA.h"  // Stack class specification file<br />
#include "StackException.h"<br />
<br />
template < class StackItemType ><br />
Stack<StackItemType>::Stack(): top(-1)<br />
{<br />
}  // end default constructor<br />
<br />
template < class StackItemType ><br />
bool Stack<StackItemType>::isEmpty() const<br />
{<br />
   return top < 0;<br />
}  // end isEmpty<br />
<br />
template < class StackItemType ><br />
void Stack<StackItemType>::push(StackItemType newItem) throw(StackException)<br />
{<br />
// if stack has no more room for another item<br />
   if (top >= MAX_STACK-1)<br />
      throw StackException("StackException: stack full on push");<br />
   else<br />
   {  ++top;<br />
      items[top] = newItem;<br />
   }  // end if<br />
}  // end push<br />
<br />
template < class StackItemType ><br />
void Stack<StackItemType>::pop() throw(StackException)<br />
{<br />
   if (isEmpty())<br />
      throw StackException("StackException: stack empty on pop");<br />
   else<br />
      --top;     // stack is not empty; pop top<br />
}  // end pop<br />
<br />
template < class StackItemType ><br />
void Stack<StackItemType>::pop(StackItemType& stackTop) throw(StackException)<br />
{<br />
   if (isEmpty())<br />
      throw StackException("StackException: stack empty on pop");<br />
   else<br />
   {  // stack is not empty; retrieve top<br />
      stackTop = items[top];<br />
      --top;     // pop top<br />
   }  // end if<br />
}  // end pop<br />
<br />
template < class StackItemType ><br />
void Stack<StackItemType>::getTop(StackItemType& stackTop) const throw(StackException)<br />
{<br />
   if (isEmpty())<br />
      throw StackException("StackException: stack empty on getTop");<br />
   else<br />
      // stack is not empty; retrieve top<br />
      stackTop = items[top];<br />
}  // end getTop<br />
// End of implementation file.


in main function of a driver class,

Stack< char > myStack;

The Visual Studio 2005 compiler gives me 6 errors that I cannot understand anything from them.
Here some of them;

Error 22 error LNK2019: unresolved external symbol "public: bool __thiscall Stack<char>::isEmpty(void)const " (?isEmpty@?$Stack@D@@QBE_NXZ) referenced in function "class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl convertInfixToPostfix(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >)" (?convertInfixToPostfix@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@Z) InfixCalculator

Error 23 error LNK2019: unresolved external symbol "public: void __thiscall Stack<char>::pop(void)" (?pop@?$Stack@D@@QAEXXZ) referenced in function "class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> > __cdecl convertInfixToPostfix(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >)" (?convertInfixToPostfix@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@@Z) InfixCalculator

Error 27 fatal error LNK1120: 5 unresolved externals InfixCalculator

Any help would be appriciated,
Thanks in advance.
AnswerRe: What is wrong with this template? Pin
Chris Losinger26-Dec-04 3:52
professionalChris Losinger26-Dec-04 3:52 
AnswerRe: What is wrong with this template? Pin
John R. Shaw26-Dec-04 13:13
John R. Shaw26-Dec-04 13:13 
QuestionHow to use SetTimer( ) when I create MFC Regular Dll? Pin
tttyip25-Dec-04 6:13
tttyip25-Dec-04 6:13 
AnswerRe: How to use SetTimer( ) when I create MFC Regular Dll? Pin
Ravi Bhavnani25-Dec-04 6:32
professionalRavi Bhavnani25-Dec-04 6:32 
GeneralControl focus question Pin
Deian25-Dec-04 5:09
Deian25-Dec-04 5:09 
GeneralRe: Control focus question Pin
Michael Dunn25-Dec-04 5:36
sitebuilderMichael Dunn25-Dec-04 5:36 
GeneralRe: Control focus question Pin
Deian25-Dec-04 5:53
Deian25-Dec-04 5:53 
GeneralConverting char to int and int to char Pin
sacoskun25-Dec-04 5:01
sacoskun25-Dec-04 5:01 
GeneralRe: Converting char to int and int to char Pin
Michael Dunn25-Dec-04 5:40
sitebuilderMichael Dunn25-Dec-04 5:40 
GeneralRe: Converting char to int and int to char Pin
Mircea Puiu25-Dec-04 5:53
Mircea Puiu25-Dec-04 5:53 
GeneralRe: Converting char to int and int to char Pin
sacoskun25-Dec-04 6:40
sacoskun25-Dec-04 6:40 
GeneralRe: Converting char to int and int to char Pin
sacoskun25-Dec-04 7:09
sacoskun25-Dec-04 7:09 
GeneralRe: Converting char to int and int to char Pin
mirex25-Dec-04 7:28
mirex25-Dec-04 7:28 
Questionhow to converte a sequence of jpeg to a movie? Pin
max_xiayi25-Dec-04 2:20
max_xiayi25-Dec-04 2:20 
GeneralImporting Dialog Pin
Sheh Shehpori24-Dec-04 23:09
sussSheh Shehpori24-Dec-04 23:09 
GeneralRe: Importing Dialog Pin
Dennis Gourjii24-Dec-04 23:41
Dennis Gourjii24-Dec-04 23:41 
GeneralRe: Importing Dialog Pin
Shah Shehpori25-Dec-04 0:06
sussShah Shehpori25-Dec-04 0:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.