Question

Linker Problem while linking List<Path_store>Path

Asked by: hthukral

I m getting linking errors

like
Dijkstra's error LNK2019: unresolved external symbol "public: __thiscall List<struct Path_store>::List<struct Path_store>(void)" (??0?$List@UPath_store@@@@QAE@XZ) referenced in function "public: __thiscall Interface::Interface(void)" (??0Interface@@QAE@XZ)

I m giving my 3 files Interface.h , linklst.cpp and .h file as I think these are related.

Interface.h

#ifndef INTERFACE_H
#define INTERFACE_H

// Header Files
#include "iostream"     // Input & Output
#include "stdlib.h"       // Use of std lib functions such as exit()
#include "stdio.h"        // Use of Input and Output Streams
#include "apvector.h"       // Used apvectors in the program
#include "Listlnk.h"     // Use of member functions of the list class

using namespace std;
// -----------------------------------------------------------------------------

// Structure for the input provided by the user

struct UserInput
{

  int vertex_1;         // Stores the first vertex
  int vertex_2;         // Stores the second vertex
  int Edge_Len;         // stores the length of the edge formed by the
                        // 2 vertices

};

// -----------------------------------------------------------------------------

// Structure for the priority queue of the Dijkstra's Algorithm

struct Prior_Q

{

  int vertex ;           // Stores the Vertices of the Graph
  int Source_Dist;      /* Stores the distance of that vertex from the source
                            vertex initially all but the source = -1.
                            -1 implies that the cost of path to that vertex
                            from the source is infinit */

};

// -----------------------------------------------------------------------------

// Structure for the Shortest/Min cost Path Storage at a given instance.

struct Path_store

{

  int vertex;           // Stores the vertex in the sloution set 'S'
  int Ver_Dist;         // Stores the shortest distance from the source.
  apvector<int> path;   // Stores the shortest path to this vertex from the
                        //  source

};


//------------------------------------------------------------------------------

// Class Interface

class Interface

{

  // ---------------------------------------------------------------------------

  public:

  // Constructor of the class

  Interface();

//------------------------------------------------------------------------------

// Input Functions

// Store the source and the end destination to the private data members.

void store_source_sink ( int source, int sink);

// Input the graph values

void input_graph(int vert_1, int vert_2, int pathLen);

// Error if same set of vertices is found in the Input List

bool same_vert_error (int vert1, int vert2);

//------------------------------------------------------------------------------

// Priority Queue Functions

// Add vertex to priority queue if it does not already exist in the priority
// queue.

void add_to_pqueue(int vert);

// Sort the priority queue according to distance of the vertex from the source
// vertex. A value of -1 implies infinity.

void sort_pqueue_dist();

// Sort the priority the queue according to vertex number
// Adds the vertex at the appropriate place.

void sort_pqueue_vert(Prior_Q &queue);

// Search the priority Q (already sorted) for a certain vertex.
// Leave the cursor at the element if found.

bool search_pqueue_vert(int key_Vert);

// Returns true if the priority queue head position implies
// there is only one element in the p-Queue

bool is_q_at_end();

//Pops the top element of the priority queue

void remove_top( Prior_Q &temp);

// Replaces the distance from the source for the vertex marked by the cursor

void replace_dist_inQ(int dist);

//------------------------------------------------------------------------------

// Path Store operations

// Adds a vertex along with its distance from the source and the corresponding
// path to the path storage.

void add_to_path(int vert, int dist, apvector<int> path);

// Searches the passed vertex and return true if it is found in the Path Store
// List

bool searchvert_in_path(int active_vert);

// Add the shortest path for a vertex to the PathStore structure.

void add_shortest_path( int vertex, int Path_Size, apvector<int> path);

// Relax the neighbouring edges and evaluate the distances of the correspoding
// vertex/Ces to the Source.

void relax_edge(int Active_vertex);
//------------------------------------------------------------------------------

// Searches for the passsed vertex in the sloution set of the Dijkstra's
// Algorithm

bool searchVertin_solnset(int vert);

//------------------------------------------------------------------------------

// Display the output. The path and shortest length

void show_result();

//------------------------------------------------------------------------------

private:

// private data members.

int source;             // Stores the source vertex while finding the shortest
                        // path

int sink;               // Stores the vertex to which the shortest path from the
                        // source is intended to.

List<UserInput> input;  // Stores the graph vertices along with the
                        // corresponding edge lengths.

List<Prior_Q>  P_Queue; // Stores the priority queue of the Dijkstra's Algorithm

List<Path_store>Path;   // Stores the shortest path & the value to  a vertex
                        // from a given source at a given time.

apvector<int> SolnSet;  // Stores the vertices already dealt with permanently.
                        // Stores the solution set of Dijkstra Algorithm.

};

#endif

Linklst.h

#ifndef LISTLNK_H
#define LISTLNK_H


template <class LE>
class List;

template < class LE >
class ListNode        // Facilitator class for the List class
{

  public:
    // Constructor
    ListNode ( const LE &elem, ListNode *nextPtr );

    // Data members

    LE element;
    ListNode *next;
    friend class List<LE>;
};

//------------------------------------------------------------------------------

template <class LE>
class List
{
  public:

      // Constructor

        List ( );

      void insert (const LE &newElement );      // Insert after cursor
      void remove ();                           // Remove Element
      void replace ( const LE &newElement );    // Replace Element
      void clear ();                             // Clear List

      // List status operations

      int empty () const;                       // List is empty
      int full () const;                        // List is full

      // List iteration operations

      int gotoBeginning ();                     // Go To Beginning
      int gotoEnd ();                           // Go to End
      int gotoNext ();                          // Go to next element
      int gotoPrior ();                        // Go to prior element
      LE  getCursor () const;                   // Return element
      int getLength();                          // Returns the length of the list
      bool isAtEnd () const;                    // Returns true if the cursor is at
                                                // end of the list


      // Output the list structure -- used in testing/debugging

      void showStructure () const;

      // In-lab oprations

      void moveToBeginning () ;                 // Move to beginning
      void insertBefore ( const LE &newElement ); // Insert before cursor

      private:

      // Data members
      ListNode<LE> *head, *cursor;         // Pointer to the beginning of the list
                                          // Cursor pointer

      friend class Interface;
      friend class ListNode<LE>;
};

#endif

linklst.cpp

// Header Files

#include "iostream.h"       // Input and Ouput
#include "listlnk.h"        // Implementation of the list functions

//------------------------------------------------------------------------------

// ListNode Class Constructor

template <class LE>
ListNode<LE>::ListNode ( const LE &elem, ListNode *nextPtr )
{
    element = elem;
    next    = nextPtr;
}

//------------------------------------------------------------------------------

// List Class Constructor

template <class LE>
List<LE>:: List ()
{
  head    = NULL;
  cursor  = NULL;

}

//------------------------------------------------------------------------------

//List class insert function. Inserts after cursor position

template <class LE>
void List<LE> :: insert ( const LE &newElement )
{
  if(!full())
  {
    if(!empty())
    {
      ListNode<LE> *temp1;
      temp1 = cursor;

      cursor = new ListNode<LE>( newElement, cursor->next);
      temp1->next = cursor;
    }

    else

    {

      cursor = new ListNode<LE> ( newElement, NULL);

      head = cursor;
    }
  }
}//end of void

//------------------------------------------------------------------------------

// List class remove function. remove element marked by cursor

template <class LE>
void List<LE> :: remove ()
{
  if(!empty())
  {
    ListNode<LE>  *temp1;

    temp1 = head;
    if( head != cursor )
    {
      while(temp1->next != cursor)
            temp1 = temp1->next;

      temp1->next = cursor->next;
      temp1 = cursor;

      if( cursor ->next !=NULL)
          cursor = cursor -> next;
      else
          cursor = head;

      delete [ ] temp1;
    }

    else
      if( cursor->next == NULL )
      {

        temp1 = cursor;
        cursor = NULL;
        head  = NULL;

        delete [  ] temp1;
      }

      else
        if( cursor->next != NULL)
        {
          temp1 = head;
          head = head->next;
          cursor = head;

          delete temp1;

        }
  }
};

//------------------------------------------------------------------------------

// List class replace function . replaces the element marked by the cursor

template <class LE>
void List<LE>::replace( const LE &newElement )
{
  if ( ! empty ( ) )
  {
    cursor->element = newElement;
  }
}

//------------------------------------------------------------------------------

// List class clear function. Clears the list

template<class LE>
void List<LE>::clear( )
{
    cursor = head;

    while ( cursor !=NULL )
    {
      head = cursor->next;
      delete [ ] cursor;
      cursor = head;
    }
}//end of void

//------------------------------------------------------------------------------

// List class empty status function

template <class LE>
int List<LE> :: empty ( ) const
{
  if ( cursor == NULL ) // returns if 1 empty
        return 1;

  else
        return 0;
}

//------------------------------------------------------------------------------

// List class  full status function

template <class LE>
int List<LE>::full ( ) const
{
  ListNode<LE>  *temp;

  if( temp == NULL )
      return 1;           // returns 1 is full

  else
      return 0;             // returns 0 otherwise

}

//------------------------------------------------------------------------------

// List class go to Begin function. Cursor moves to the beginning

template <class LE>
int List<LE>::gotoBeginning ()
{
  if(! empty ())
  {
      cursor = head;
      return 1;

  }

  else
  {
    return 0;
  }
}

//------------------------------------------------------------------------------

// List class go to end function. Cursor moves to the end of the list

template <class LE>
int List<LE>::gotoEnd ()
{
    if(! empty () )
    {
      while (cursor->next != NULL)
        cursor = cursor->next;

          return 1;
    }

    else
    {
        return 0;
    }
}

//------------------------------------------------------------------------------

// List class to go Next function Cursor moves to the next element in the list

template <class LE>
int List<LE>::gotoNext ()
{
  if(!empty ())
  {
    if(cursor->next !=NULL)
    {
      cursor = cursor->next;
          return 1;
    }

    else
    {
      return 0;
    }
  }

  else
  {
    return 0;
  }
}

//------------------------------------------------------------------------------

// List class getcursor for Returns the element marked by the cursor

template <class LE>
LE List<LE>::getCursor () const
{
  if(!empty ())
  {
    return cursor->element;
  }
}

//------------------------------------------------------------------------------

// List class goto Prior function Cursor moves to the prior element

template <class LE>
int List<LE>::gotoPrior ()
{
  if(!empty() && head!=cursor )
  {
    ListNode<LE> * temp;

    temp = head;

    while(temp->next != cursor)
        temp = temp->next;

        cursor = temp;
        return 1;
  }

  else
  {
    return 0;
  }
}

//------------------------------------------------------------------------------

template <class LE>
void List<LE>::showStructure () const

// Outputs the elements in a list. If the list is empty , outputs
// "Empty List". This operation is intended for testing and debugging purpose only

{

  ListNode<LE> *p;      // Interface through the list

  if ( head  == 0 )
      cout << "Empty list" << endl;

  else
  {
    for( p = head; p!= 0; p = p->next )

    if ( p == cursor )
        cout << "[" << p->element << "] ";
    else
      cout << p->element << " ";
        cout << endl;
  }
}


//------------------------------------------------------------------------------

// Returns the number of nodes in the linked list.

template <class LE>
int List<LE>::getLength()
{
  if(empty())
    return 0;
  else
  {
    ListNode<LE> *temp;
    temp = cursor;

    int i = gotoBeginning();
    int count = 1;

    while( cursor->next !=NULL)
    {
      cursor = cursor->next;
      count++;
    }

    cursor = temp;
    return count;
  }
}

//------------------------------------------------------------------------------

// List class insertbefore function. Inserts a new node before the position
// marked by the cursor.

template <class LE>
void List<LE>::insertBefore ( const LE &newElement )
{
  if(!full())
  {
    if(!empty() && head != cursor)
    {
      ListNode<LE> *temp;

      temp = head;
      while( temp->next != cursor)
           temp = temp->next;

        cursor = new ListNode<LE> ( newElement, cursor)

        temp->next = cursor;
    }

    else

    {

      cursor = new ListNode<LE> ( newElement, cursor);
      head = cursor;
    }
  }
}

//------------------------------------------------------------------------------

// Returns true if the cursor is at the end of the list else returns false

template <class LE>
bool List<LE>::isAtEnd() const
{
  if(!empty())
  {
    if( cursor->next == NULL)
        return true;
    else
        return false;
  }

  return false;
}


What can be the reason calling this linking problem....
I need help on this problem immediately...I m doing a mesh project in the uni which is due soon and I m stuck on this linker error

Regards

Harsimrat

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-11-29 at 23:16:34ID21224268
Topic

C++ Builder

Participating Experts
2
Points
250
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Colors with cout
    I'm wondering if there is a way to give a string a color with cout? I know how to do with cprintf but not with cout.
  2. std::cout vs cout
    This is weird: A description of the problem: The code here (most likely full of errors / oversights) doesnt seem to operate in the proper timeline. The std::cout line near the bottom appears to execute prior to the cout commands. If all cout comands are changed to std::cou...
  3. Cout color
    Is there any way to change the color of the cout statements, or cin for that matter?
  4. gets and cout ... conflict
    hi, first of all i know the alternate solutions to this problem, actually i want to know the reasons !!! below i am pasting the code for reference .... the prb is that if i use gets and cout together .... the cout statement written before gets(--) (e.g. "Enter Array&qu...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: hthukralPosted on 2004-11-29 at 23:21:38ID: 12703381

Dijkstra's error LNK2019: unresolved external symbol "public: __thiscall List<struct Prior_Q>::List<struct Prior_Q>(void)" (??0?$List@UPrior_Q@@@@QAE@XZ) referenced in function "public: __thiscall Interface::Interface(void)" (??0Interface@@QAE@XZ)

Dijkstra's error LNK2019: unresolved external symbol "public: __thiscall List<struct UserInput>::List<struct UserInput>(void)" (??0?$List@UUserInput@@@@QAE@XZ) referenced in function "public: __thiscall Interface::Interface(void)" (??0Interface@@QAE@XZ)

Dijkstra's error LNK2019: unresolved external symbol "public: int __thiscall List<struct UserInput>::gotoNext(void)" (?gotoNext@?$List@UUserInput@@@@QAEHXZ) referenced in function "public: bool __thiscall Interface::same_vert_error(int,int)" (?same_vert_error@Interface@@QAE_NHH@Z)


I'm using Visual.Net 2003 Compiler .

And these are 20 link errors such like these...

Thanx

Harsimrat

 

by: SteHPosted on 2004-11-30 at 02:11:52ID: 12704161

This TA is mainly for BCB (the Borland compiler). You can ask in community support to move this Q to TA "C++".

STL headers should always be included in the form
#include <iostream>
otherwise the compiler might not find the headers.

Can it be that you have nowhere the line
#include <list>
?

 

by: andrewjbPosted on 2004-11-30 at 02:14:22ID: 12704175

Don't know about Visual.Net 2003, but many compilers require the implementation of template classes to be in the .h file, not a separate .cpp

e.g.

template <class LE>
class List
{
  public:

      // Constructor

       List ( )
       {
           .. implementation code goes here    <<------------------------
        };

etc.

 

by: SteHPosted on 2004-11-30 at 02:14:34ID: 12704177

Sorry I now saw that you have your own implementation of the list class. But for templates to work they need to be fully inside the header. There is no real implementation for a template; the compiler will generate the code according to the specified type. So it can't compile the templated cpp files and you get the linker errors.

Put linklst.cpp at the end of linklst.h

 

by: SteHPosted on 2004-11-30 at 02:15:22ID: 12704182

Too late;-(

 

by: andrewjbPosted on 2004-11-30 at 02:19:12ID: 12704202

:-)

 

by: hthukralPosted on 2004-11-30 at 08:10:10ID: 12707214

andrewjb and steh

I did that it starts compiling now it has some warnings

listlnk.h(326): warning C4715: 'List<UserInput>::getCursor' : not all control paths return a value

listlnk.h(326): warning C4715: 'List<Prior_Q>::getCursor' : not all control paths return a value

lislnk.h(326): warning C4715: 'List<Path_store>::getCursor' : not all control paths return a value

listlnk.h(239): warning C4700: local variable 'temp' used without having been initialized

These are all warnings I thought it to run....but when it runs it goes to unhadled exception immediately

This is the header file which it finds Exception handling:-

Converts a character string into an int or long.


#else  /* defined (_MT) && !defined (_UNICODE) */
        while ( _istspace((int)(_TUCHAR)*nptr) )
#endif  /* defined (_MT) && !defined (_UNICODE) */
            ++nptr;

I have main file these are the lines where it is getting to this error

 // Converts the input ( source, sink) to integer value

  source = atoi(&(*argv[1]));
  sink = atoi(&(*argv[2]));

Fast help will be really appreciated... Andrewjb is leading the points race.......

Thanx Guys

Harsimrat



 

by: SteHPosted on 2004-11-30 at 08:15:08ID: 12707291

template <class LE>
LE List<LE>::getCursor () const
{
  if(!empty ())
  {
    return cursor->element; // here you return.
  }
 // but it not empty () nothing gets returned. Could this return value be NULL?
}

 

by: hthukralPosted on 2004-11-30 at 08:15:51ID: 12707300

I will increase 100 pts for this question guys when I get the answer...Rite now 250 is going to andrewjb....I even compiled my code in Borland C++ Builder X it is throwing me tons of different errors.

I m using AP classes this guy is finding errors in APvector.h and Apvector.cpp implementations thats out of my knowledge area.

Thanx

Harsimrat

 

by: SteHPosted on 2004-11-30 at 08:17:12ID: 12707314

template <class LE>
int List<LE>::full ( ) const
{
  ListNode<LE>  *temp; // variable is create but no value is assigned.

  if( temp == NULL ) // how should temp found its value to compare?
      return 1;           // returns 1 is full

  else
      return 0;             // returns 0 otherwise

}

 

by: SteHPosted on 2004-11-30 at 08:17:28ID: 12707319

2:1? ;-)

 

by: SteHPosted on 2004-11-30 at 08:19:52ID: 12707353

>I m using AP classes this guy is finding errors in APvector.h and Apvector.cpp implementations thats out of my knowledge area.
Are you using STL headers (#include <iostream>) or old borland style (#include "iostream.h")? The latter is potentially harmful if other files are using STL headers.

 

by: hthukralPosted on 2004-11-30 at 08:24:15ID: 12707406

Steh

I had <iostream.h> but I changed to <iostream> and using namespace std; but it is still finding errors in AP classes which Visual Studio.Net is compiling properly. I'm using the same files at both places....I m compiling Borland Code under Linux...

Thanx

Harsimrat

 

by: SteHPosted on 2004-11-30 at 08:28:39ID: 12707449

It perhaps could be a new question since it is somehow unrelated to the title.

Or is the same error as above? Are apvector.cpp or .h added to the project? They only should be included.

If not post the lines with errors together with their messages.

 

by: hthukralPosted on 2004-11-30 at 08:55:16ID: 12707778

Steh-

I will give more points for all my solutions as I need everything in a hurry.....it is slightly of the original ...bcoz all you guys are of C++ builder so I had that compiler i moved my code there.....apvector.h and .cpp are in the project no other file

These are the list of errors

"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `ist' with no type at line 1
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `mySize' with no type at line 2
"apvector.cpp": apvector.cpp error: `rhs' was not declared in this scope at line 2
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `myList' with no type at line 3
"apvector.cpp": apvector.cpp error: syntax error before `[' token at line 3
"apvector.cpp": apvector.cpp error: syntax error before `for' at line 7
"apvector.cpp": apvector.cpp error: syntax error before `;' token at line 7
"apvector.cpp": apvector.cpp error: syntax error before `++' token at line 7
"apvector.cpp": apvector.cpp error: syntax error before `::' token at line 16
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `length' with no type at line 19
"apvector.cpp": apvector.cpp error: non-member function `int length()' cannot have `const' at line 19
method qualifier
"apvector.cpp": apvector.cpp error: syntax error before `::' token at line 24
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `operator[]' with no at line 28
type
"apvector.cpp": apvector.cpp error: `int operator[](int)' must be a nonstatic member at line 28
function
"apvector.cpp": apvector.cpp error: `int operator[](int)' must take exactly two arguments at line 28
apvector.cpp: In function `int operator[](int)':
"apvector.cpp": apvector.cpp error: `cerr' undeclared (first use this function) at line 32
"apvector.cpp": apvector.cpp error: (Each undeclared identifier is reported only once for at line 32
each function it appears in.)
"apvector.cpp": apvector.cpp error: `endl' undeclared (first use this function) at line 33
"apvector.cpp": apvector.cpp error: `exit' undeclared (first use this function) at line 34
"apvector.cpp": apvector.cpp error: invalid types `int[int]' for array subscript at line 36
apvector.cpp: At global scope:
"apvector.cpp": apvector.cpp error: syntax error before `::' token at line 40
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `operator[]' with no at line 45
type
"apvector.cpp": apvector.cpp error: non-member function `int operator[](int)' cannot have ` at line 45
const' method qualifier
"apvector.cpp": apvector.cpp error: `int operator[](int)' must be a nonstatic member at line 45
function
"apvector.cpp": apvector.cpp error: `int operator[](int)' must take exactly two arguments at line 45
apvector.cpp: In function `int operator[](int)':
"apvector.cpp": apvector.cpp error: redefinition of `int operator[](int)' at line 45
"apvector.cpp": apvector.cpp error: `int operator[](int)' previously defined here at line 28
"apvector.cpp": apvector.cpp error: redefinition of `int operator[](int)' at line 45
"apvector.cpp": apvector.cpp error: `int operator[](int)' previously defined here at line 28
"apvector.cpp": apvector.cpp error: `exit' undeclared (first use this function) at line 50
"apvector.cpp": apvector.cpp error: invalid types `int[int]' for array subscript at line 52
apvector.cpp: At global scope:
"apvector.cpp": apvector.cpp error: syntax error before `::' token at line 56
"apvector.cpp": apvector.cpp error: ISO C++ forbids declaration of `resize' with no type at line 64
apvector.cpp: In function `int resize(int)':
"apvector.cpp": apvector.cpp error: `itemType' undeclared (first use this function) at line 70
"apvector.cpp": apvector.cpp error: `newList' undeclared (first use this function) at line 70
"apvector.cpp": apvector.cpp error: syntax error before `[' token at line 70
"apvector.cpp": apvector.cpp error: invalid types `int[int]' for array subscript at line 73
"apvector.cpp": apvector.cpp error: type `int' argument given to `delete', expected pointer at line 75
apvector.cpp: At global scope:
"apvector.cpp": apvector.cpp error: syntax error before `/' token at line 79
In file included from apvector.cpp:126:
"stdlib.h": /usr/include/stdlib.h error: syntax error before `(' token at line 137
In file included from /usr/include/sys/types.h:266,
from /usr/include/stdlib.h:416,
from apvector.cpp:126:
"pthreadtypes.h": /usr/include/bits/pthreadtypes.h error: 'size_t' is used as a type, but is at line 48
not defined as a type.
"pthreadtypes.h": /usr/include/bits/pthreadtypes.h error: 'size_t' is used as a type, but is at line 51
not defined as a type.
In file included from apvector.cpp:126:
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 433
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 433
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 462
"stdlib.h": /usr/include/stdlib.h error: syntax error before `,' token at line 462
"stdlib.h": /usr/include/stdlib.h error: `size_t' was not declared in this scope at line 556
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 556
"stdlib.h": /usr/include/stdlib.h error: `size_t' was not declared in this scope at line 558
"stdlib.h": /usr/include/stdlib.h error: syntax error before `,' token at line 558
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 567
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 567
In file included from /usr/include/stdlib.h:578,
from apvector.cpp:126:
Build cancelled due to errors
"alloca.h": /usr/include/alloca.h error: `size_t' was not declared in this scope at line 33
"alloca.h": /usr/include/alloca.h error: syntax error before `)' token at line 33
In file included from apvector.cpp:126:
"stdlib.h": /usr/include/stdlib.h error: `size_t' was not declared in this scope at line 583
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 583
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 588
"stdlib.h": /usr/include/stdlib.h error: syntax error before `,' token at line 588
"stdlib.h": /usr/include/stdlib.h error: `void exit(int)' used prior to declaration at line 612
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 739
"stdlib.h": /usr/include/stdlib.h error: syntax error before `,' token at line 739
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 743
"stdlib.h": /usr/include/stdlib.h error: syntax error before `,' token at line 743
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 812
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 812
"stdlib.h": /usr/include/stdlib.h error: type specifier omitted for parameter `size_t' at line 815
"stdlib.h": /usr/include/stdlib.h error: syntax error before `)' token at line 815

 

by: SteHPosted on 2004-11-30 at 09:01:23ID: 12707845

Either of them are template files as STL headers or your list. You can't compile them. You need to create a class which uses that template and the compiler will create the code for it.

List<int> iList; // the compiler will replace all occurences of the template class with int and compile that code.
List<string> sList; // now the compiler does the same except that string is the substitute.

have a look at
http://www.skylit.com/faqs/#qhcpp

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...