Hello , thanks for any help in advance.
Im writing some code for a c++ class and the proffessor wants us to
implement a list template using arrays.
I thought this would be an easy task but have been stuck with the same
error and i cant seem to fix it. I think its the constructor but i dont
know how to fix it .
My error is:
List error LNK2019: unresolved external symbol "public: __thiscall
List<double,80>::List<double,80>(void)" (??0?$List@N$0FA@@@QAE@XZ)
referenced in function _main
My Code:
********
list.h
********
template <class DATA, int MAX_LIST_SIZE>
class List
// Stores a list of DATA with the member functions shown below.
// Positions in the list are numbered starting with 1 (not 0).
{
public:
// constuctors -- no destructor needed
List();
List(const List<DATA,MAX_LIST_SIZE>& original);
// accessors
bool isEmpty() const;
bool isFull() const;
int getLength() const { return _firstOpen; }
DATA retrieve (int position, bool& success) const;
// mutators
void insert (int position, DATA newItem, bool& success);
// inserts newItem into specifice position
// --- except that, if position is past the end of the list,
// inserts at the end of the list
void remove(int position, bool& success);
private:
DATA _element[MAX_LIST_SIZE];
// For space efficiency, I'll store the 1st element
// in position 0; the second, in position 1, etc.
int _firstOpen;
};
*********
list.h
*********
#include "list.h"
template <class DATA, int MAX_LIST_SIZE>
List<DATA,MAX_LIST_SIZE>::List()
{
_firstOpen=0;
DATA _element[MAX_LIST_SIZE];
}
/*template <class DATA, int MAX_LIST_SIZE>
List<DATA,MAX_LIST_SIZE>::List(const List<DATA,MAX_LIST_SIZE>&
original)
{
DATA=original.DATA;
MAX_LIST_SIZE=original.MAX_LIST_SIZE;
//DATA _element[MAX_LIST_SIZE];
}
*/
template <class DATA, int MAX_LIST_SIZE>
bool List<DATA,MAX_LIST_SIZE>::isEmpty() const
{
return _firstOpen==0;
}
template <class DATA, int MAX_LIST_SIZE>
bool List<DATA,MAX_LIST_SIZE>::isFull() const
{
return _firstOpen==MAX_LIST_SIZE;
}
template <class DATA, int MAX_LIST_SIZE>
void List<DATA,MAX_LIST_SIZE>::insert(int position, DATA newItem, bool&
success)
{
if(position > MAX_LIST_SIZE)
{
DATA _element[MAX_LIST_SIZE]=newItem;
}
else
{
DATA _element[position]=newItem;
}
}
template <class DATA, int MAX_LIST_SIZE>
void List<DATA,MAX_LIST_SIZE>::remove(int position, bool& success)
{
DATA _element[position]="deleted";
}
template <class DATA, int MAX_LIST_SIZE>
DATA List<DATA,MAX_LIST_SIZE>::retrieve (int position, bool& success)
const
{
return DATA _element[position];
}
********
listTest
********
#include "list.h"
#include <iostream>
using namespace std;
int main()
{
List<double,80> test;
return 0;
}; 4 1552
The class is a template class - to instantiate a particular instance of
a template class, the whole class definition must be visible in the
particular translation unit. In listTest, you need to include list.cpp
in order to resolve your problem.
Regards,
Srini
Don't make someone a *priority* who only makes you an *option*...
I tried that but that wasnt it , its driving me insane
oh im using Visual C++ .Net
I don't have any problems compiling and executing your code with the
Microsoft optimising C++ compiler - ver 13.10.3077.
Really?!
I gave up on the error and will just attempt to ask the proffessor
tommorow , im not sure if the error I'm getting is specific to .Net ,
i've seen it do crazy things sometimes!
thanks for the input though , and if anyone else can shed some light on
this issue please do so This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ws Wang |
last post by:
MySQLdb is working fine at command line, however when I tried to use
it with mod_python, it give me a "server not initialized" error.
This is working fine:
----------------------- testmy.py...
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing...
|
by: YZK |
last post by:
Hello. I'm not a Web developer, just a user, and I think I may have
somehow messed myself up majorly. I'm not quite sure how. Right now,
javascript used by websites I go to either does not work at...
|
by: Danny |
last post by:
I have this bit of code:
SELECT itemcode, min(Price) AS minprice
FROM itemlist
GROUP BY itemcode;
it lists the minimum price for each itemcode group. It works fine.
But when I want to see...
|
by: Chua Wen Ching |
last post by:
Hi there,
I saw this article here in vb.net.
http://www.error-bank.com/microsoft.public.dotnet.languages.vb.1/148992_Thread.aspx
and
...
|
by: Joner |
last post by:
Hello,
I'm having trouble with a little programme of mine where I connect to
an access database. It seems to connect fine, and disconnect fine, but
then after it won't reconnect, I get the error...
|
by: Nurit N |
last post by:
This is the third newsgroup that I'm posting my problem.
I'm sorry for the multiple posts but the matter becoming urgent.
I hope this is the right place for it...
I have created a very...
|
by: Piripiccio |
last post by:
Hello , please give me a little minute for this problem
the first thing ..... my english is very bad
I wrote a little program that using a socket pair with 2 process Padre
(Father) and Figlio...
|
by: roadbai |
last post by:
Hi all,
This is the first time to post question here, hopefully experts of perl here can give me a hand, to be honest, I am kind of new to perl, and I am struggling with the "Out of memory" issue I...
|
by: Jo |
last post by:
Hi there,
I'm Jo and it's the first time I've posted here. I'm in process of creating
a database at work and have come a little unstuck.....I'm a bit of a novice
and wondered if anyone could...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| | |