Unresolved external symbol
От: Mikula  
Дата: 09.07.11 20:07
Оценка:
Не пойму, почему выдает:
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall AStack<unsigned char,8>::~AStack<unsigned char,8>(void)" (??1?$AStack@E$07@@QAE@XZ) referenced in function _wmain
1>main.obj : error LNK2019: unresolved external symbol "public: unsigned char __thiscall AStack<unsigned char,8>::Pop(void)" (?Pop@?$AStack@E$07@@QAEEXZ) referenced in function _wmain
1>main.obj : error LNK2019: unresolved external symbol "public: bool __thiscall AStack<unsigned char,8>::Push(unsigned char)" (?Push@?$AStack@E$07@@QAE_NE@Z) referenced in function _wmain
1>main.obj : error LNK2019: unresolved external symbol "public: __thiscall AStack<unsigned char,8>::AStack<unsigned char,8>(void)" (??0?$AStack@E$07@@QAE@XZ) referenced in function _wmain



MS VC++ 2010 Express. Фрагменты файлов:

// main.cpp 
#include "stdafx.h"
#include "AStack.h"

int _tmain(int argc, _TCHAR* argv[])
{
    AStack<UCHAR, 8> stack;
    stack.Push(1);
    UCHAR b;
    b = stack.Pop();
    
    return 0;
}


// AStack.h
#ifndef ASTACK_H
#define ASTACK_H

template<class C, int size> class AStack
{
private:
    C*    arr;
    int    cur;

public:
    AStack();
    ~AStack();
    bool    Push(C el);
    C    Pop();
};
#endif


// AStack.cpp
#include "AStack.h"

template<class C, int size>
AStack<C, size>::AStack()
{
    arr = new C[size];
    cur = 0;
}
...
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.