473,763 Members | 6,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need some help with inheritence with STL

pb
Im getting this compile error,
undefined reference to BitString<10>:: scramble()
collect2: ld returned 1 exit status

For some reason the compiler cant find the symbol for the member function i
declare. Everythign compiles correctly up to the point when i make a call to
the "scramble" routine. Calling the member functions of the base class work
just fine, but when i try to call the member functions i declare in the
extened class, the linker cant find the symbols. any ideas?

thx for the help...

// BitString.h

#include <bitset>
using namespace std;

template <size_t N>
class BitString : public bitset <N> {
public:
Bitstring <N>():bitset<N> (){};
void scramble();
};

//Bitstring.cpp

template <size_t N>
BitString<N>::s cramble()
{
return;
}

// main.cpp
#include "BitString. h"
int
main()
{
BitString<10> data;
data.scramble()
return;
}
Jul 22 '05 #1
1 1257
On Wed, 17 Nov 2004 21:44:08 -0800 in comp.lang.c++, "pb"
<gl*****@yahoo. com> wrote,
Im getting this compile error,
undefined reference to BitString<10>:: scramble()


This issue is covered in Marshall Cline's C++ FAQ. See the topics
"[34.12] Why can't I separate the definition of my templates class
from it's declaration and put it inside a .cpp file?" and
"[34.13] How can I avoid linker errors with my template functions?".
It is always good to check the FAQ before posting. You can get the
FAQ at:
http://www.parashift.com/c++-faq-lite/

Jul 22 '05 #2

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

Similar topics

5
2429
by: john bailo | last post by:
For a c# web application, I created a user control that includes a form in control. The idea is, on the main Page, when the user clicks Submit from the master form, that makes the user control visible and gives it new functionality, but retains the look of the top half of the master page. I then hide the original submit button. Ok, now, after pressing the Submit button in the user control, I want to change the look of the master page.
8
2847
by: JustSomeGuy | last post by:
I need to write an new class derived from the list class. This class stores data in the list to the disk if an object that is added to the list is over 1K in size. What methods of the std stl list class must Ioverride in order for this to work?
16
3094
by: gorda | last post by:
Hello, I am playing around with operator overloading and inheritence, specifically overloading the + operator in the base class and its derived class. The structure is simple: the base class has two int memebers "dataA", "dataB". The derived class has an additional int member "dataC". I am simply trying to overload the + operator so that 'adding' two objects will sum up the corresponding int members.
19
1700
by: JKop | last post by:
Been thinking about the following: class Mammal { public: virtual void Mate(Mammal &) = 0; };
7
1985
by: preetam | last post by:
Hi, This question is more towards design than towards c++ details. By looking at books on design patterns and various google threads on the same topic, I see that composition is favoured to inheritence. One more article I read was Allen holub's "Why extends is evil". http://www.javaworld.com/javaworld/jw-08-2003/jw-0801-toolbox.html One general advice I found was that - extending behaviour is better done with interfaces and...
9
2084
by: jon wayne | last post by:
OK! I had this nagging doubt Consider (without worrying abt access specifiers) class Kid : public Parent{...}; Parent::someFunc() { Kid k; }
5
2124
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of disagreement about whether is essential in C++". Are there any disadvantages of using multiple inheritence?
6
3861
by: bjwillykajilly | last post by:
ok, so we're to right this program(in bluej) that consists of a few classes that will ultimately simulate a simple billfold(consisting of credit cards) a main card class, a drivers license, an id card, and a calling card. Now, i'm not coming to you guys to finish my program, i'm coming to you guys so i can understand it(as it is my major, as of 2 days ago) class Card { public String name; public Card() { name = "";} ...
9
1710
by: Chrissy | last post by:
I took a C# class as an elective and received an incomplete in it and am desparate for help. I have two assignments left (arrays and inheritance) and would gladly pay anyone that can assist me with this. I want you to know that I'm a 41 year old mother of three boys (ages 9, 7, and 2) and have done my very best to muddle through this course. Sadly, my old brain is not equipped to handle it. LOL Chrissy
0
9564
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9823
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7368
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6643
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.