UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C++
  • » Using slist with GCC 4.4.4

#1 2011-06-15 01:08 PM

jacquesdirac
Member
Registered: 2009-02-06
Posts: 15

Using slist with GCC 4.4.4

Hi,

I have to migrate some code that contains slist from gcc 2.96 to gcc 4.4.4, but I'm not getting further.

Parts of the .h-file:

...
#include <libcalg/slist.h>
...
class MultiPlexor;

class Descriptor {
public:
	Descriptor();
	virtual ~Descriptor();
...

protected:
...
	friend class MultiPlexor;

private:
...
	MultiPlexor *mux;
};

...

class MultiPlexor {
public:
	MultiPlexor();

	int eventWait(timeval *timeout = NULL);
	void add(Descriptor *dp);
	void remove(Descriptor *dp);

private:
        slist<Descriptor *> dlist;
    
};

g++ complains on the slist<Descriptor *> dlist; line with:

error: ISO C++ forbids declaration of 'slist' with no type
error: expected ';' before '<' token

Q1: Do I need really need lib-c-algorithms (v1.2.0) for slist? I also found include/c++/4.4.4/ext/slist. How can I use that?

Q2: How can I solve the g++ error?

Hope you can help me with this.

PS.: Similar problems elsewhere on the internet are solved by adding using namespace std;, but this doesn't fix mine.

Offline

#2 2011-06-15 04:22 PM

i3839
Oddministrator
From: Amsterdam
Registered: 2003-06-07
Posts: 2,230

Re: Using slist with GCC 4.4.4

You have to post much more code for us to have a chance finding the problem.
Try to create a minimal failure case which you can post here.

But it really looks like the compiler can't find the definition of slist.
Try '#include <slist>'

Offline

  • Index
  • » C++
  • » Using slist with GCC 4.4.4

Board footer

Powered by FluxBB