[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

Linker Problem while linking List<Path_store>Path

Asked by hthukral in C++ Builder

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
[+][-]11/30/04 09:01 AM, ID: 12707845Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: C++ Builder
Sign Up Now!
Solution Provided By: SteH
Participating Experts: 2
Solution Grade: A
 
[+][-]11/29/04 11:21 PM, ID: 12703381Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/30/04 02:11 AM, ID: 12704161Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 02:14 AM, ID: 12704175Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 02:14 AM, ID: 12704177Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 02:15 AM, ID: 12704182Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 02:19 AM, ID: 12704202Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:10 AM, ID: 12707214Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/30/04 08:15 AM, ID: 12707291Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:15 AM, ID: 12707300Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/30/04 08:17 AM, ID: 12707314Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:17 AM, ID: 12707319Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:19 AM, ID: 12707353Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:24 AM, ID: 12707406Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/30/04 08:28 AM, ID: 12707449Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/30/04 08:55 AM, ID: 12707778Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/06/06 07:34 AM, ID: 15629565Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]01/10/06 04:24 AM, ID: 15659192Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92