Bug 18795 - Undefined reference to deque
Summary: Undefined reference to deque
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: egcs
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-10 11:09 UTC by Stephen Torri
Modified: 2007-04-18 16:29 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-10-02 19:07:35 UTC
Embargoed:


Attachments (Terms of Use)

Description Stephen Torri 2000-10-10 11:09:52 UTC
I am trying to use the "queue" from the standard library (stl_queue) via
the include file /usr/include/g++-2/queue. When I create the queue as part
of a single file to test the usages of the queue it compiles fine. When I
create the queue as a part of a class then it fails to compile. Here is the
error results of the compile process. I can perform any tests required as
needed:

g++ -W -Wall -pipe -D_POSIX_THREADS -D_POSIX_THREAD_SAFE_FUNCTIONS
-D_REENTRANT -DACE_HAS_AIO_CALLS -O3 -g -Wno-uninitialized
-fno-implicit-templates    -I/usr/src/ACE_wrappers -DACE_HAS_EXCEPTIONS
-DTAO_HAS_AMI=0 -DTAO_HAS_AMI_POLLER=0 -DTAO_HAS_AMI_CALLBACK=0
-DTAO_HAS_RT_CORBA=1 -DTAO_HAS_CORBA_MESSAGING=1   
-I/usr/src/ACE_wrappers/TAO    -L/usr/src/ACE_wrappers/TAO/tao
-L/usr/src/ACE_wrappers/ace -L./ -o dgcc .obj/CommsS.o .obj/CommsC.o
.obj/master.o .obj/dgcc.o -lTAO -lACE -ldl -lpthread -lrt 

.obj/master.o: In function `Master::addCommands(basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >)':
/usr/include/g++-2/stl_deque.h:445: undefined reference to
`deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >, __default_alloc_template<true, 0>,
0>::push_back_aux(basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> > const &)'
.obj/master.o: In function `Master::printQueue(void)':
/usr/include/g++-2/stl_deque.h:472: undefined reference to
`deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >, __default_alloc_template<true, 0>,
0>::pop_front_aux(void)'
.obj/master.o: In function `queue<basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >,
deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >, __default_alloc_template<true, 0>, 0>
>::~queue(void)':
/usr/src/dgcc/master.cpp(.queue<basic_string<char,
string_char_traits<char>, __default_alloc_template<1, 0> >,
deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<1, 0> >, __default_alloc_template<1, 0>, 0>
>::gnu.linkonce.t.(void)+0x56): undefined reference to
`deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >, __default_alloc_template<true, 0>,
0>::create_map_and_nodes(unsigned int)'
.obj/master.o: In function `Master::setupMaster(basic_string<char,
string_char_traits<char>, __default_alloc_template<true, 0> >)':
/usr/src/dgcc/master.cpp:69: undefined reference to
`deque<basic_string<char, string_char_traits<char>,
__default_alloc_template<true, 0> >, __default_alloc_template<true, 0>,
0>::destroy_map_and_nodes(void)'
collect2: ld returned 1 exit status
make: *** [dgcc] Error 1


***********
Master.cpp (edited for content)
***********
#include "master.h"
#include <pfstream.h>
#include <iostream>
#include <string>
#include <cstdlib>
#include <queue>

using namespace std;

...
queue < string > execQueue; // stack of files to process
...

// function: start execution of makefile queue
void Master::startJob()
{
  int result = -1;
  string run = "";  

  const char* run_chars;
  unsigned int i = 0;

  while(execQueue.size() > 1)
  {
     run = execQueue.front();
      //      cout << "Run: " << run << endl;
      run_chars = run.c_str();

      // this would be the best point to make the call to a slave. After
receiving a value of 0 (sucess) then
      // remove the command from the stack. If a failure (value > 0 or -1)
then print out error, cmd from stack and exit.
      execQueue.pop();

      result = system(run_chars);
      
      if(result != 0){

        //-----------------------------
        // Start problem line analysis
        //----------------------------- 
        cout << "Run: " << run << endl;
        cout << "Chars: ";
        
        for(i = 0; i < strlen(run_chars); i++)
          {
            cout << run_chars[i] << " ";
          }
        cout << endl;
        
        //----------------------------
        // end analysis
        //----------------------------

        exit(1);
      }
    }

...

void Master::addCommands(string makeCommand){

  char c;                  // used to get characters returned from
ipfstream
  string target = "";      // the target command that will add to the
execQueue
  int result = -1;         // indicate whether or not we have another make
command
  
  const char *runPtr = getCommand(makeCommand);
  
  ipfstream runPipe(runPtr, ios::in, 0664);
  
  while((c = runPipe.get()) != EOF)
    {
      if(c == '\n')
        {

          // check here to see if "target" is another make command
          // if it is then run this make command and add it
          // then allow the original make command to continue
          // return only a list of strings not a queue

          result = target.rfind("make ",0,5);

          //      cout << "Target: " << target << endl;

          if(result > 0)
            {
              cout << "Found another make command" << endl;
              addCommands(target);
            }
          else
            {
                execQueue.push(target);
            }

          target = "";
          result = -1;
        }
      else
        {
          target += c;
        }
    }
}

Comment 1 Jakub Jelinek 2004-10-02 19:07:35 UTC
STL has been rewritten from scratch in GCC 3.0.  If you see a problem
still with GCC 3.x, please reopen.


Note You need to log in before you can comment on or make changes to this bug.