나는 의심의 여지가 있으므로 여기에 몇 가지 도움을 청한다. 미리 감사드립니다.LNK2019 해결되지 않은 외부 기호?
이 같은 파일 시스템의 기본 기능을 구현하는 클래스 정의 :
//Header.h
#include <iostream>
using namespace std;
typedef int BOOL;
#define TRUE 1
#define FALSE 0
typedef struct NODE
{
struct NODE *prev;
int data;
struct NODE *next;
}NODE,*PNODE,**PPNODE;
class doubly_circular
{
private:
PNODE head;
PNODE tail;
public:
doubly_circular();
~doubly_circular();
BOOL insertfirst(int);
BOOL display();
int count();
};
나는이에 이중 원형 연결리스트를 사용하고 있습니다.
//main.cpp
int main()
{
doubly_circular obj1,obj2;
obj1.insertfirst(1);
obj1.insertfirst(101);
obj1.insertfirst(151);
obj1.display();
return 0;
}
doubly_circular::~doubly_circular()
{
free(head);
free(tail);
}
여전히 링커 부여 제가 모든 기능을 분리했지만 아직 날이 오류
Error 1 error LNK2019: unresolved external symbol "public: __thiscall doubly_circular::~doubly_circular(void)" ([email protected]@[email protected]) referenced in function _main I:\doublycircularLL\doublycircularLL\main.obj doublycircularLL
제공 : 위의 기능이 같은
//helper.cpp
doubly_circular::doubly_circular()
{
head=NULL;
tail=NULL;
}
BOOL doubly_circular::display()
{
PNODE temp=head;
if((head==NULL)&&(tail==NULL))
{
return FALSE;
}
do
{
cout<<temp->data<<endl;;
temp=temp->next;
}while(tail->next!=temp);
return TRUE;
}
BOOL doubly_circular::insertfirst(int ino)
{
PNODE newN=NULL;
newN->prev=NULL;
newN->data=ino;
newN->next=NULL;
if((head==NULL)&&(tail==NULL))
{
head=newN;
tail=newN;
tail->next=newN;
head->prev=tail;
return TRUE;
}
else
{
newN->next=head;
head->prev=newN;
head=newN;
head->prev=tail;
tail->next=newN;
return TRUE;
}
}
메인의
정의 나 오류, 누군가가 내가 잘못하고있는 것을 알아 차리는 경우 알려 주시기 바랍니다. 또한 누구에게 더 많은 정보가 필요한지 알려주십시오.
PNODE newN=NULL; // this is incorrect, as you will not be able to assign data to a node
PNODE newN=new NODE; // construct new node
newN->prev=NULL;
newN->data=ino;
newN->next=NULL;
를 그리고 마지막으로 - 사용 표준을 :: 목록을 컨테이너로 대신 새를 발명 : 감사합니다 당신이 아주 많이 모두의
C++에 내장 된 유형이 'bool'인지 알고 계셨습니까? –
그리고'doubly_circular' 소멸자는 어디에 구현합니까? –
오류를 해결하려면'doubly_circular'에 대한 소멸자를 선언하지만 정의하지 마십시오. –