473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

error C2309: '{ctor}': is not a member of...

Here is the portion of my code giving a problem:

#include <cassert>
#include <iostream>
using namespace std;

template <class BaseData>
class ListNode
{
BaseData listdata;
ListNode *link;

};

template <class BaseData>
class linklist {

protected:
ListNode<BaseData*current, *head;

public:
//The class has the following required member functions:
//1. Insert an item in numerical order
void ordered_insert(const BaseData&);
//2.Determine if the List is empty
int listempty();
//3.Search the list for an item and remove it
void search_remove(BaseData);
//4.Return the number of items in the list
int listcount();
//5. Insert an item at the beginning of the list.
void insert_beg(BaseData);
//6. Insert an item at the end of the list.
void insert_end(BaseData);
//7. Return and remove an item from the end of the list
BaseData rt_end_value();
//8. Return and remove an item from the beginning of the list
BaseData rt_beg_value();
//9. Return an Item from the list
BaseData rt_value();
//10. Moves pointer to the next item
void move_next();
//to print out the list for the driver program
//overload stream insertion operator
friend ostream & operator<<(ostream&, const linklist<BaseData>&);
//These were done in class but I did not use
int beg_list();
int at_end();
};
template <class BaseData>
linklist<BaseData>::linklist()
{
head = NULL;
current = head;
}//this is the line the problem is on but I would guess the input
stream operator overloading is the problem

template <class BaseData>
ostream& operator<<(ostream& osObject, const linklist<BaseData>& list)
{
current = list.head;

while(current != NULL)
{
osObject<<current-<info<<" ";
current = current->link;
}
return osObject;
}

The problem is I am receiving an error: error C2309: '{ctor}': is not
a member of 'linklist<BaseData>'

I have included iostream so I know that is not the problem. I just
can not figure it out. Any one have any ideas. I have marked the
line the error comes up on.

Mar 18 '07 #1
5 5993
On 18 Mar, 20:45, t...@weismannwebservices.com wrote:

<...>
template <class BaseData>
class linklist {
//#######################
// add declaration of ctor in class definition ...
linklist();
//###############
/*
....
*/
};

<...>

The problem is I am receiving an error: error C2309: '{ctor}': is not
a member of 'linklist<BaseData>'
regrads
Andy Little

Mar 18 '07 #2
On 18 Mar, 21:00, "kwikius" <a...@servocomm.freeserve.co.ukwrote:
On 18 Mar, 20:45, t...@weismannwebservices.com wrote:

<...>
template <class BaseData>
class linklist {

//#######################
// add declaration of ctor in class definition ...
// hmm... probably want it public too ..

public:
linklist();
//###############
Mar 18 '07 #3
On Mar 18, 5:01 pm, "kwikius" <a...@servocomm.freeserve.co.ukwrote:
On 18 Mar, 21:00, "kwikius" <a...@servocomm.freeserve.co.ukwrote:
On 18 Mar, 20:45, t...@weismannwebservices.com wrote:
<...>
template <class BaseData>
class linklist {
//#######################
// add declaration of ctor in class definition ...

// hmm... probably want it public too ..

public:
linklist();
//###############


Thanks for the help...I did figure that out and felt a little stupid
afterwards :) but now I am having a new error when linking. The
overload of the insertion operator must be having a problem after
all. My cout's in main for a linklist object are outputting errors
when linking. The erros are:

Error 1 error LNK2019: unresolved external symbol "class
std::basic_ostream<char,struct std::char_traits<char & __cdecl
operator<<(class std::basic_ostream<char,struct std::char_traits<char>
&,class linklist<intconst &)" (??6@YAAAV?$basic_ostream@DU?
$char_traits@D@std@@@std@@AAV01@ABV?$linklist@H@@@ Z) referenced in
function _wmain assignment4.obj
Error 2 fatal error LNK1120: 1 unresolved externals F:\CS
255\assignment4\Debug\assignment4.exe 1
Mar 18 '07 #4
And I did fix:
osObject<<current-<info<<" ";
to:
osObject<<current->info<<" ";

Already
Mar 18 '07 #5
On Mar 18, 5:48 pm, t...@weismannwebservices.com wrote:
On Mar 18, 5:01 pm, "kwikius" <a...@servocomm.freeserve.co.ukwrote:
On 18 Mar, 21:00, "kwikius" <a...@servocomm.freeserve.co.ukwrote:
On 18 Mar, 20:45, t...@weismannwebservices.com wrote:
<...>
template <class BaseData>
class linklist {
//#######################
// add declaration of ctor in class definition ...
// hmm... probably want it public too ..
public:
linklist();
//###############

Thanks for the help...I did figure that out and felt a little stupid
afterwards :) but now I am having a new error when linking. The
overload of the insertion operator must be having a problem after
all. My cout's in main for a linklist object are outputting errors
when linking. The erros are:

Error 1 error LNK2019: unresolved external symbol "class
std::basic_ostream<char,struct std::char_traits<char & __cdecl
operator<<(class std::basic_ostream<char,struct std::char_traits<char>&,class linklist<intconst &)" (??6@YAAAV?$basic_ostream@DU?

$char_traits@D@std@@@std@@AAV01@ABV?$linklist@H@@@ Z) referenced in
function _wmain assignment4.obj

Error 2 fatal error LNK1120: 1 unresolved externals F:\CS
255\assignment4\Debug\assignment4.exe 1
I changed the ostream declaration to:
template <class BaseDatafriend ostream & operator<<(ostream&, const
linklist<BaseData>&);
and that fixed it.

Mar 19 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Joergen Bech | last post by:
Fairly new to ASP.NET 1.1. Getting the error below when running application on a web server outside of my control, but only the first time I run it: 1. After a long period of inactivity (or...
5
by: PasalicZaharije | last post by:
Hallo, few days ago I see ctor like this: Ctor() try : v1(0) { // some code } catch(...) { // some code }
1
by: Raghuram N K | last post by:
Hi, Following program compiles and executes successfully in windows with DevCPP compiler. When I compile the same in Linux with 'g++323' compiler I get following assignment error: cannot...
8
by: Grizlyk | last post by:
Good morning. Look here: http://groups.google.com/group/fido7.ru.cpp.chainik/browse_frm/thread/7341aba5238c0f79 and here:...
2
by: subramanian | last post by:
Consider the following program: #include <iostream> #include <string> class Member { int x; int y; public: Member(int argx, int argy);
1
by: todd | last post by:
Here is the portion of my code giving a problem: #include <cassert> #include <iostream> using namespace std; template <class BaseData> class ListNode { BaseData listdata;
7
by: Valeriu Catina | last post by:
Hi, consider the Shape class from the FAQ: class Shape{ public: Shape(); virtual ~Shape(); virtual void draw() = 0;
6
by: Grey Alien | last post by:
class A { public: A(const B& ref); private: static B& b ; }; How may b be initialized ?
4
by: Cirene | last post by:
In my web.config I added <pages enableSessionState="true">. In each of my pages I also added EnableSessionState="True" to the Page declaration. (I didn't think this was necessary, but...) ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.