Solved

Borland Classlib with TCWin45

Posted on 1997-01-07
1
1,563 Views
Last Modified: 2008-03-03
I have problems using the Borland Classlib. The classlib files
are in the direcotry "c:\tcwin45\include\classlib\obsolete".
I am using Borland Turbo C++ V4.5 unde win95. I am trying to
compile an EasyWin program.
--------------------------------------------
I if enter a simple! code like this:

#include "c:\tcwin45\include\classlib\obsolete\SortArry.h"

int main()
{
     SortedArray a(3);

     return 0;
}

I get a sea of linker errors (20+) and just as many linker
warnings. This happens when ever I try to use the Classlib.
I have tried several exampels from the actual classlib and
none work. EI:

#include "c:\tcwin45\include\classlib\obsolete\strng.h"
#include "c:\tcwin45\include\classlib\obsolete\array.h"

int main()
{
      Array a(2);
      String *s1 = new String("a string");
      String *s2 = new String("another string");

      a.add(*s1);
      a.add(*s2);

      return 0;
}

When I compile that code, I get the following error messages:

Compiling TST_STR.CPP:
Linking tst_str.exe:
Linker Warning: No module definition file specified: using defaults
Linker Warning: Possible reference to undefined extern Object::ZERO in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::~AbstractArray() in module TST_STR.CPP
Linker Error: Undefined symbol Array::add(Object far&) in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::AbstractArray(int,int,unsigned int) in module TST_STR.CPP
Linker Error: Undefined symbol Object::ZERO in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::printContentsOn(ostream far&) const in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::detach(int,Object::TShouldDelete::DeleteType) in module TST_STR.CPP
Linker Error: Undefined symbol Collection::findMember(Object far&) const in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::detach(Object far&,Object::TShouldDelete::DeleteType) in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::initIterator() const in module TST_STR.CPP
Linker Error: Undefined symbol Container::printTrailer(ostream far&) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::printSeparator(ostream far&) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::printHeader(ostream far&) const in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::flush(Object::TShouldDelete::DeleteType) in module TST_STR.CPP
Linker Error: Undefined symbol Container::printOn(ostream far&) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::lastThat(int(far*)(const Object far&,void far*),void far*) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::firstThat(int(far*)(const Object far&,void far*),void far*) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::forEach(void(far*)(Object far&,void far*),void far*) in module TST_STR.CPP
Linker Error: Undefined symbol AbstractArray::isEqual(const Object far&) const in module TST_STR.CPP
Linker Error: Undefined symbol Container::hashValue() const in module TST_STR.CPP

What is wrong?

-= Christian
0
Comment
Question by:Christian Reimer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
isc earned 50 total points
ID: 1162192
There are a couple of problems here that I see. First, the linker errors tell me that the "newer", pass by reference array classes have been defined and are being used. Under TargetExpert, I expect you will see that the "Class Libraries" checkbox is checked. You will have to uncheck this and explicitly add the obsolete class libraries to your project. You will have to re-create this library if it doesn't exist; or you could simply add the source code .cpp files to your project. This should permit your project to link properly.

However, it still appears that the newer class library header files are being included somewhere. Look for any other regular OWL header files being included.

These problems are due to the fact that while the obsolete class libraries are available to you, they are not inherently supported without a lot of effort. I would suggest that you consider the newer class libraries in a BC example such as this:

// ---------------------------------------------------------------------------
// Copyright (C) 1994 Borland International
// iarray.cpp
//    Must link with myclass.cpp.                    
// ---------------------------------------------------------------------------

#include <classlib/arrays.h>
#include <iostream.h>
#include <strstrea.h>
#include "../myclass.h"

typedef TIArrayAsVector<MyClass> ContainerType;
typedef TIArrayAsVectorIterator<MyClass> IteratorType;

const int MaxItems=6;

void ForEachCallBack(MyClass& mc, void* s)
{
    cout << (char*)s << mc << endl;
}

void AddItems(ContainerType& container, int numItems)
{
    for( int i=numItems; i>0; i-- )
        {
        char buf[80];
        ostrstream str( buf, sizeof(buf) );
        str << i << " hello" << ends;
        container.Add( new MyClass(buf) );
        }
}

void UseForwardIterator(ContainerType& container)
{
    IteratorType iterator(container);
    while( iterator )
        {
        cout << *iterator.Current() << endl;
        iterator++;
        }
}

void UseIndex(ContainerType& container)
{
    for( int i=container.LowerBound(); i<container.UpperBound(); i++ )
        cout << *container[i] << endl;
}

int main()
{
    ContainerType container(MaxItems);
    AddItems(container, MaxItems);
 
    cout << "--- Starting ForEach" << endl;
    container.ForEach(ForEachCallBack, (void*)"FE ");
 
    cout << "--- Starting Iterator (forward)" << endl;
    UseForwardIterator(container);
 
    cout << "--- Using operator[]" << endl;
    UseIndex(container);
 
    return 0;
}

I got this from the examples directory. The MyClass files are included here but they should be included in the distribution set.


0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
convert char array to number in c 5 93
How to split this in C++ 4 129
Gaming Software 1 38
parameter pack in c++11 2 23
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question