Hi! I can compile the following code, but when I try to run it with the line a.out File1.txt, my programming partner get a seg fault, and I get this error:
a.out: relocation error: a.out: symbol __cxa_allocate_exception, version XXABI_1.3 not defined in file libstdc++.so.6 with link time reference

I found this link, but I don't understand what it means.

Links to included/relevant files:
mystring.h | string.cpp | SplayTree.h | QueueAr.h | SplayTree.cpp | QueueAr.cpp

This is the code, and I have red-ed the parts that I think are problem areas:

#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
#include "mystring.h"
#include "string.cpp"
#include "SplayTree.h"
#include "QueueAr.h"

class GrabStuff
                void setWord (string);
                string getWord ();
                void setLineNumber (int);
                friend ostream& operator<< (ostream &, const GrabStuff&);
                string myWord;
                Queue<int> *myLineNumbers;
                Queue<int> *temp;

GrabStuff::GrabStuff() {}

GrabStuff::GrabStuff(string s) {     myWord = s;     }

GrabStuff::~GrabStuff() {}

void GrabStuff::setWord (string w) {     myWord = w;     }

string GrabStuff::getWord () {     return myWord;     }

void GrabStuff::setLineNumber (int num)

ostream& operator<< (ostream &os, const GrabStuff &name)
        os << name.myWord << " ";
        while (!name.myLineNumbers->isEmpty())
                int num = name.myLineNumbers->dequeue();
                os << num << " ";
        while (!name.temp->isEmpty())
                name.myLineNumbers->enqueue( name.temp->dequeue() );
        return os;

Any help would be appreciated. Thank you!

Recommended Answers

All 3 Replies

u haven't initialized the variables
myLineNumbers and temp

and u are trying to operate on it.

Initialize them in the constructor as:

myLineNumbers = new Queue<int>();
temp = new Queue<int>();

Lifesaver, dkalita. For the second time today! Thank you so much!

please mark te thread as solved if u think its solved......thanks........n welcome.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.