473,396 Members | 1,666 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,396 software developers and data experts.

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>::scramble()
{
return;
}

// main.cpp
#include "BitString.h"
int
main()
{
BitString<10> data;
data.scramble()
return;
}
Jul 22 '05 #1
1 1240
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
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...
8
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...
16
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...
19
by: JKop | last post by:
Been thinking about the following: class Mammal { public: virtual void Mate(Mammal &) = 0; };
7
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...
9
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
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...
6
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...
9
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.