Strange problem when using C++ Class

H

howa

// LinkedList.h

#pragma once

struct Node {
int data;
Node* next;
};

class LinkedList {

private:

Node* head;
size_t length;
void destroyList(Node**);

public:

LinkedList();
~LinkedList();

size_t getLength() { return length;};

void insert(int);
void remove(int);

void printList();

};

// LinkedList.cpp

#include "LinkedList.h"

LinkedList::LinkedList() {
head = 0;
};

LinkedList::~LinkedList() {
destroyList(&head);
};

//VS.net 2005 return: error LNK2019: unresolved external symbol
"private: void __thiscall LinkedList::destroyList(struct Node * *)"

what are the possible reason ?

thanks.
 
V

Victor Bazarov

howa said:
// LinkedList.h

#pragma once

Pragmas are implementation-defined. There is no way to tell
what effect this has without being off-topic.
struct Node {
int data;
Node* next;
};

class LinkedList {

private:

Node* head;
size_t length;
void destroyList(Node**);

Here is the declaration of 'destroyList' member.
public:

LinkedList();
~LinkedList();

size_t getLength() { return length;};

void insert(int);
void remove(int);

void printList();

};

// LinkedList.cpp

#include "LinkedList.h"

LinkedList::LinkedList() {
head = 0;
};

LinkedList::~LinkedList() {
destroyList(&head);

Here is where you use the 'destroyList' member.
};

//VS.net 2005 return: error LNK2019: unresolved external symbol
"private: void __thiscall LinkedList::destroyList(struct Node * *)"

what are the possible reason ?

One possible reason is that there is no _definition_ of 'destroyList'
member function *anywhere* in your program.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top