473,406 Members | 2,549 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,406 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 6002
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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.