Help - want C++ generic linked-list class code

Help - want C++ generic linked-list class code

Post by Tony Nuge » Wed, 02 Feb 1994 15:30:50



Help!

I need a source code for fully functional C++ generic linked-list
class.

I'm fairly new to C++ (but not to programming) and struggling to
build my own linked list class (it only really needs to be a
singly-linked class, but a doubly-linked list would be preferable).

Templates are NOT an easy thing to implement!  (I keep getting
strange compiler errors, even though my code looks ok so far:
yes, I've read all the documentation and text books that I can,
no, I don't _really_ understand the finer points of it all; yes,
I've read the FAQ's).

Frustration is a common companion of the emerging programmer :)

I'm *sure* that this has been done before!  (Of course it has:)
So, instead of re-inventing the wheel, can some kind soul send me
something that compiles, links, and works?

It needs to be able to compile and run under dos (I'm using
BC3.1) and unix (cc, gcc, g++, c++, and I think CC are available).
(BC3.1 does have a list class, but it is not suitable for my
needs, and I seriously doubt that it will compile under unix).

Specifically, I need to create objects that will link together
(fixed-length) strings of data.  I also need methods to be able
to edit (ie, insert, delete, change) _characters_ in these
strings, but I could add these methods once I have the lists
working properly (in fact, I will eventually need to be able to
some really fancy things to this data).  I then need another
object to manage multiple instances of these data lists (by
managing pointers to each of these lists).

This data engine will then become the central core of a
specialist scientific application I am building.  (And then I
have to a build suitable user interface to it... and I'm _sure_
I'll be asking for help again when this happens:)

I have looked at the Simtel and garbo ftp sites for any useful
code, but what I have seen there either does not compile properly
or is not suitable for my needs.

I would be _very_ grateful for any help in obtaining suitable
source code (and docs) that will either compile and run
right-out-of-the-box, or will help me go along way with what I've
done so far.

Many thanks in advance,
Tony

--
  /--------------------------------------------------------------\


       \____________________________________________________________\___/

 
 
 

Help - want C++ generic linked-list class code

Post by Aaron Jacks » Thu, 17 Feb 1994 10:35:18


Quote:>   I need a source code for fully functional C++ generic linked-list
>   class.

My, this is an old thread, my apologies.  Check at ftp.inria.fr in prog/libraries
and you'll find something ready made.
--

 
 
 

1. Linking C code with C++ code

Hi,

Let me describe a challenging problem for me. I have some old c code
which has some functionality I need to keep as is and some C++ code I
also need to leave as is. I need to create a link between the c code and
C++ code.

So, I just made a new .h and .cpp file which defines the interface
functions to the C++ functions. Compiled the new .cpp to a .o file. Now,
I did a #include of my new .h file in one of the old c code .c files.
Since the new .h was included, I used the functions in a few places of
the old c code.

Then I added to the (old c code) makefile the additonal .o (from the new
cpp) for linking, added the new .h also to the (old c code) makefile,
and Shezzaam, I thought the two would be linked. Nope. Oh, I have WATCOM
C and C++ on QNX 4.2, a POSIX compliant varient of UNIX.

The linker says the function names in the new .h file are unreferenced,
undefined when
trying to compile the old c code. Since the .h has the prototypes of the
new functions, I am
confused. I did found from the disassembler (wdisasm) that the 'c'
compiler (wcc386) appended an ' _ ' (underscore) to every function name
we had added to the old c code.

Since the #included .h did not have ' _ ' (underscore) on the function
names, I thought that was the problem. Using a preprocessor directive
(#pragma aux's), I forced the 'c' compiler NOT to
append the ' _ ' to the new function names in the .o file.

But, no luck. the 'c' compiler still says Warning(1028): blah, blah is an
unreferenced name and then the fatal Error messages saying blah, blah is
an undefined name.

So, how do I get my 'c' compiler to link in the new .o file in?

Michael R.

2. Fixing unaligned access Solaris 2.3

3. Help Link C/C++ code

4. Couple qiuck fs q's..

5. Help linking c++ code with c

6. Minimum configuration (files)

7. Looking for C++ String and List class

8. Measuring the size of stack and heap

9. Dynamic Library Link and C++ CLASS?

10. c++ class browser wanted

11. Wanted : C++ Thread class

12. C/C++ code/class browser

13. Simple C++ Telnet Class Wanted