By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,194 Members | 821 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,194 IT Pros & Developers. It's quick & easy.

expected class-name before '{'

P: n/a
Hi,

i´ve got about 10 headerfiles with implemented classes. Now when i try

to compile them i get the following message:
In file included from Proxy/ServerCnx.hh:36,
from Proxy/Payload.hh:30,
...
from main.cc:28
Proxy/Interface.hh:83: error: expected class-name before '{'
The Interface.hh looks like this:
class Module : public ClientCnx{...}
so far, i realisied that ClientCnx isn´t declarated. So I tried to
make a forward Declaration
by using
class ClientCnx;
but now, the compiler says:
Proxy/Interface.hh:83: error_ invalid use of undefined type `ClientCnx`

Proxy/Interface.hh:30: error_ forward declaration of `ClientCnx`
now what can i do to fix this prob ?!?

Sep 25 '06 #1
Share this Question
Share on Google+
19 Replies


P: n/a
bubzilla wrote:
Hi,

i´ve got about 10 headerfiles with implemented classes. Now when i try
to compile them i get the following message:

In file included from Proxy/ServerCnx.hh:36,
from Proxy/Payload.hh:30,
...
from main.cc:28
Proxy/Interface.hh:83: error: expected class-name before '{'

The Interface.hh looks like this:

class Module : public ClientCnx{...}

so far, i realisied that ClientCnx isn´t declarated. So I tried to
make a forward Declaration
by using

class ClientCnx;
A forward declaration isn't sufficient here, the compiler needs to see
the whole declaration of the base classes.
>
but now, the compiler says:

Proxy/Interface.hh:83: error_ invalid use of undefined type `ClientCnx`

Proxy/Interface.hh:30: error_ forward declaration of `ClientCnx`
now what can i do to fix this prob ?!?
Find the header file that declares the base class and include it before
the declaration of Module.

Regards,
Stuart
Sep 25 '06 #2

P: n/a

bubzilla wrote:
Hi,

i´ve got about 10 headerfiles with implemented classes. Now when i try

to compile them i get the following message:
In file included from Proxy/ServerCnx.hh:36,
from Proxy/Payload.hh:30,
...
from main.cc:28
Proxy/Interface.hh:83: error: expected class-name before '{'
The Interface.hh looks like this:
class Module : public ClientCnx{...}
so far, i realisied that ClientCnx isn´t declarated.
That certainly sounds like a reasonable conclusion.
So I tried to make a forward Declaration
But why do you think a forward declaration would help?
by using
class ClientCnx;
but now, the compiler says:
Proxy/Interface.hh:83: error_ invalid use of undefined type `ClientCnx`

Proxy/Interface.hh:30: error_ forward declaration of `ClientCnx`
now what can i do to fix this prob ?!?
ClientCnx is a base class of Module and the compiler needs to know the
full definition of ClientCnx before it sees Module. A forward
declaration just tells the compiler that ClientCnx is the name of a
class. That is not enough. You need to include the entire class
definition of ClientCnx. If ClientCnx is defined in a header, #include
that header above the definition of class Module.

Gavin Deane

Sep 25 '06 #3

P: n/a
Ok, i had the same solution. So i tried to change the header includes,
but some how i did got a way so that no error appears!

so, do i have to try again, to find the right include order.

Or can it be that there is somekind of circle that has to be solved in
a other way?
I'm not familiar how the Compiler brings the headerfiles together?

Sep 25 '06 #4

P: n/a
bubzilla wrote:
Ok, i had the same solution. So i tried to change the header includes,
but some how i did got a way so that no error appears!
So it's working now?
>
so, do i have to try again, to find the right include order.

Or can it be that there is somekind of circle that has to be solved in
a other way?
I'm not familiar how the Compiler brings the headerfiles together?
It's the preprocessor that brings the header files together..

You'll be getting multiple defined errors if you have cyclic includes..
You can avoid that problem by using include guards:

#ifndef SOME_UNIQUE_LABEL
#define SOME_UNIQUE_LABEL
code;
#endif
--
// morten
Sep 25 '06 #5

P: n/a
bubzilla wrote:
Ok, i had the same solution. So i tried to change the header includes,
but some how i did got a way so that no error appears!
That's good.
so, do i have to try again, to find the right include order.

Or can it be that there is somekind of circle that has to be solved in
a other way?
I'm not familiar how the Compiler brings the headerfiles together?
Use include guards, as Morten suggests.

If you build a class hierarchy you should always include any base
classes in your header files before you declare the derived class:

In base.h:
#ifndef BASE_H_INCLUDED
# define BASE_H_INCLUDED
class Base
{...};
#endif

In Derived.h:
#ifndef DERIVED_H_INCLUDED
# define DERIVED_H_INCLUDED
class Derived : public Base
{...};
#endif

If you have classes that have pointers to each other, you need forward
declarations:

In A.h:
// Forward declaration of class B. Now the compiler
// can handle pointers and references to class B,
// provided they are not de-referenced.
class B;
class A
{
// Pointer to instance of class B
class B* b;
};

in B.h:
class B
{
// Pointer to instance of class A. Note the
// class keyword, that is used as forward declaration
// of name A.
class A* b;
};

Regards,
Stuart
Sep 25 '06 #6

P: n/a

:-(

strange, i use include guards,
and i use forward declarations for owner ship

that´s why i posted in this group cause i just can´t find a reason!

Sep 25 '06 #7

P: n/a
Help help help, i´m haven´t found a solution yet! :-(

Here is the order how the my Header files are included:

main.cc
#include "Proxy/RtspProxy.hh"

RtspProxy.hh
#include "InterfaceModule.hh"

InterfaceModule.hh
#include "ServerCnx.hh"

ServerCnx.hh
#include "RtspProxy.hh"

RtspProxy.hh
#include "InterfaceModule.hh" NO_MORE
#include "ClientCnx.hh"

ClientCnx.hh
#include "Payload.hh"

Payload.hh
#include "ServerCnx.hh" NO_MORE
Payload.code

#include "ClientStream.hh"
ClientCnx.code

#include "ServerCnx.hh" NO_MORE
#include "RtspMsg.hh"

RtspMsg.hh
RtspMsg.code

#include "RtspController.hh"

RtspController.hh
#include "ClientCnx.hh" NO_MORE
#include "SdpMsg.hh"

SdpMsg.hh
#include"RtspMsg.hh" NO_MORE
SdpMsg.code

#include "RtspMsg.hh" NO_MORE
#include "Scheduler/Scheduler.hh"

Scheduler.hh
Scheduler.code

#include "Socket.hh"

Socket.hh
Socket.code

#include "Utils/Exception.hh"
Utils/Exception.hh
Utils/Exception.code

RtspController.code

#include "Socket.hh" NO_MORE
#include "Scheduler/Scheduler.hh" NO_MORE
#include "Utils/membind.hh"

membind.hh
membind.code

RtspProxy.code

#include "Payload.hh" NO_MORE
#include "InterfaceModule.hh" NO_MORE
#include "ServerStream.hh"

ServerStream.hh
#include "ServerCnx.hh" NO_MORE
#include "Socket.hh" NO_MORE
#include "Scheduler/Scheduler.hh" NO_MORE
ServerStream.code

#include "RtspController.hh" NO_MORE
#include "RtspMsg.hh" NO_MORE
#include "InterfaceList.hh"

InterfaceList.hh
InterfaceList.code

#include "Socket.hh" NO_MORE
ServerCnx::code

#include "ClientCnx.hh" NO_MORE
#include "InterfaceList.hh" NO_MORE
InterfaceModule::code

#include "ClientCnx.hh" NO_MORE
#include "ServerCnx.hh" NO_MORE
#include "RtspMsg.hh" NO_MORE
#include "RtspController.hh" NO_MORE
#include "Socket.hh" NO_MORE
#include "Scheduler/Scheduler.hh" NO_MORE
#include "Utils/membind.hh"

membind.hh
membind.code

RtspProxy::code
main::code

now i still get a error :

in file: included from RtspProxy.hh:50,
from ServerCnx.hh:34,
from Payload.hh:30,
from ClientCnx.hh:34,
from ClientStream.hh:33,
from ClientStream.cc:23:
InterfaceModule.hh:87: error: incvlad use of undefined type `struct
ClientCnx'
RtspController.hh:59: error: forward declaration of `struct ClientCnx'
OK, now in RtspController.hh I use a forward Declaration of ClientCnx
cause I need the Class as the Type of an Parameter:

ClientRtspController( ClientCnx* )

but later I need the Class as a Baseclass in InterfaceModule.hh:

class PassthroughModule : public ClientCnx

i don´t get this thing fxxxing solved! ÄÄÄÄÄÄÄ

Sep 27 '06 #8

P: n/a
bubzilla wrote:
Help help help, i´m haven´t found a solution yet! :-(

Here is the order how the my Header files are included:

[...]
Make sure none of your headers have double inclusion guards that
share the same macro -- a common copy-paste mistake.

Without seeing the code nothing else springs to mind.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Sep 27 '06 #9

P: n/a
bubzilla wrote:
Help help help, i´m haven´t found a solution yet! :-(

Here is the order how the my Header files are included:
[snipped include graph]
>
now i still get a error :

in file: included from RtspProxy.hh:50,
from ServerCnx.hh:34,
from Payload.hh:30,
from ClientCnx.hh:34,
from ClientStream.hh:33,
from ClientStream.cc:23:
InterfaceModule.hh:87: error: incvlad use of undefined type `struct
ClientCnx'
RtspController.hh:59: error: forward declaration of `struct ClientCnx'
OK, now in RtspController.hh I use a forward Declaration of ClientCnx
cause I need the Class as the Type of an Parameter:

ClientRtspController( ClientCnx* )

but later I need the Class as a Baseclass in InterfaceModule.hh:

class PassthroughModule : public ClientCnx

i don´t get this thing fxxxing solved! ÄÄÄÄÄÄÄ
Could you make a copy of your source tree and take away all the
definitions that are not necessary for us to see? Take out all members
that are of a different type than the above classes. Also take out all
members that are pointers or references to any of the above classes.
Take away all base classes that don't belong to the offending hierarchy.

You should end up with classes that look like the following:

ClientCnx.hh (just an example, your code would certainly look different):
class ClientCnx : public InterfaceModule // Base class declaration that
// needs to see the class
// InterfaceModule
{
// Member that needs to see the class Payload.
Payload m_Payload;
};

Then post the headers and the offending .cpp file (that only needs to
contain the offending includes). Then we can have a look at it and
(hopefully) help you.

Stuart
Sep 27 '06 #10

P: n/a
There are 3 headers:

InterfaceModule.hh
RtspController.hh
ClientCnx.hh

InterfaceModule.hh has a Derived Class and the Base is ClientCnx in
CLientCnx.hh,
RtspController has a Pointer on his owner, which is of type ClientCnx
and ClientCnx
like this
InterfaceModule.hh:
class Derived : public ClientCnx{ ... };

RtspController.hh:
class Controller {
ClientCnx ptr;
};

ClientCnx.hh:
class ClientCnx{
Controller ptr;
}

so, InterfaceModule.hh needs ClientCnx.hh be be included for the Base:
ClientCnx
and
ClientCnx.hh needs RtspController.hh to be included an i need a forward
declaration in RtspController.hh for ClientCnx

but then i compile, an error accures like

InterfaceModule.hh: error: incvlad use of undefined type `struct
ClientCnx'
RtspController.hh: error: forward declaration of `struct ClientCnx'

???

Sep 27 '06 #11

P: n/a

bubzilla wrote:
There are 3 headers:

InterfaceModule.hh
RtspController.hh
ClientCnx.hh

InterfaceModule.hh has a Derived Class and the Base is ClientCnx in
CLientCnx.hh,
RtspController has a Pointer on his owner, which is of type ClientCnx
and ClientCnx
like this
It is preferable that your header includes the header it needs so that
your source files can include the headers they need in any order.

When you have a hierarchy of classes where one is an abstract base and
the other is simply an implementation that has no extra public methods,
it is preferable that only the implementation file for the derived
class and any closely associated classes know about the derived class
(thus including its header).
InterfaceModule.hh:
class Derived : public ClientCnx{ ... };

RtspController.hh:
class Controller {
ClientCnx ptr;
};
If Derived provides no new public methods of its own then most of your
source should be using ClientCnx, not Derived. Such source should be
including the header for ClientCnx (ClientCnx.hh) only.
ClientCnx.hh:
class ClientCnx{
Controller ptr;
}

so, InterfaceModule.hh needs ClientCnx.hh be be included for the Base:
ClientCnx
and
ClientCnx.hh needs RtspController.hh to be included an i need a forward
declaration in RtspController.hh for ClientCnx
What is Controller? You have called the member ptr so is it a pointer?
ClientCnx is a base class (possibly an abstract one). You haven't given
it any methods (nor terminated it with a semi-colon) but much of the
time abstract classes should not give away any of their implementation
detail, so if they do have any pointer members they should generally be
to only forwardly-declared classes. A lot of the time they will have no
member variables at all. Note that ClientCnx should also have either a
public virtual destructor or a protected non-virtual one.
but then i compile, an error accures like

InterfaceModule.hh: error: incvlad use of undefined type `struct
ClientCnx'
Because you didn't include it in the header. By the way, if the file is
called InterfaceModule.hh the class should probably be called
InterfaceModule and not Derived. InterfaceModule should be a type of
ClientCnx.
RtspController.hh: error: forward declaration of `struct ClientCnx'
It will need that forward declaration if it needs to know of ClientCnx
as a type but doesn't need to know anything else about it, i.e. its
size of any of its methods.

Sep 27 '06 #12

P: n/a
bubzilla wrote:
There are 3 headers:

InterfaceModule.hh
RtspController.hh
ClientCnx.hh

InterfaceModule.hh has a Derived Class and the Base is ClientCnx in
CLientCnx.hh,
RtspController has a Pointer on his owner, which is of type ClientCnx
and ClientCnx
like this

InterfaceModule.hh:
class Derived : public ClientCnx{ ... };

RtspController.hh:
class Controller {
ClientCnx ptr;
As you mentioned above, this should be a pointer (maybe this was the
fault all the time). In my example below I replaced this by
ClientCnx* ptr;
};

ClientCnx.hh:
class ClientCnx{
Controller ptr;
The same here.
}

so, InterfaceModule.hh needs ClientCnx.hh be be included for the Base:
ClientCnx
and
ClientCnx.hh needs RtspController.hh to be included an i need a forward
declaration in RtspController.hh for ClientCnx

but then i compile, an error accures like

InterfaceModule.hh: error: incvlad use of undefined type `struct
ClientCnx'
RtspController.hh: error: forward declaration of `struct ClientCnx'
Here is my version of the three headers:
------------------------------------------------
ClientCnx.hh:
------------------------------------------------
#ifndef _CLIENTCNX_HH
# define _CLIENTCNX_HH

// We don't need to see Controller here,
// since we only hold a pointer to this
// class.

// Forward declaration for Controller class.
class Controller;

class ClientCnx{
Controller* ptr;
};
#endif // _CLIENTCNX_HH

------------------------------------------------
RtspController.hh:
------------------------------------------------
#ifndef _RTSPCONTROLLER_HH
# define _RTSPCONTROLLER_HH
// We don't need to see ClientCnx here,
// since we only hold a pointer to this
// class.

// Forward declaration for ClientCnx class.
class ClientCnx;

class Controller
{
ClientCnx* ptr;
};

#endif // _RTSPCONTROLLER_HH
------------------------------------------------
InterfaceModule.hh:
------------------------------------------------
#ifndef _INTERFACEMODULE_HH
# define _INTERFACEMODULE_HH

// We need to see the whole definition
// of ClientCnx, since we derive from
// it.
#include "ClientCnx.hh"

class Derived : public ClientCnx
{
};

#endif // _INTERFACEMODULE_HH
------------------------------------------------
main.cpp:
------------------------------------------------
#include "InterfaceModule.hh"
int main ()
{
Derived Module;
return 0;
}

main.cpp compiles fine, although the compiler warns that the variable
Module is never used.

I hope this helps,
Stuart
Sep 28 '06 #13

P: n/a

first of all: THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX

second: it don´t work yet

third: here are all my relevant files and their includes:
main.cc
#include "Proxy/RtspProxy.hh"
RtspProxy.hh
#include "InterfaceModule.hh"
#include "RtspController.hh"
#include "ClientCnx.hh"
#include "ServerCnx.hh"
#include "RtspMsg.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"
#include "Utils/membind.hh"
InterfaceModule.hh
#include "RtspController.hh"
#include "InterfaceList.hh"
RtspController.hh
#include "ClientCnx.hh"
#include "SdpMsg.hh"
#include "RtspMsg.hh"
#include "Scheduler/Scheduler.hh"
#include "Socket.hh"
#include "Utils/Exception.hh"
ClientCnx.hh
#include "InterfaceList.hh"
#include "RtspMsg.hh"
#include "Payload.hh"
#include "ClientStream.hh"
ServerCnx.hh
#include "RtspProxy.hh"
#include "Payload.hh"
#include "InterfaceModule.hh"
#include "ServerStream.hh"
#include "RtspController.hh"
#include "RtspMsg.hh"
#include "InterfaceList.hh"
#include "Socket.hh"
Payload.hh
#include "ServerCnx.hh"
ServerStream.hh
#include "ServerCnx.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"

these are the includes in all headerfiles, some have no includes
my compiler says:

g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o main.o main.cc
g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o Proxy/ClientStream.o Proxy/ClientStream.cc
In file included from Proxy/RtspProxy.hh:50,
from Proxy/ServerCnx.hh:34,
from Proxy/Payload.hh:30,
from Proxy/ClientCnx.hh:34,
from Proxy/ClientStream.hh:33,
from Proxy/ClientStream.cc:23:
Proxy/InterfaceModule.hh:88: error: invalid use of undefined type
`struct satcom::rtspProxy::ClientCnx'
Proxy/RtspController.hh:59: error: forward declaration of `struct
satcom::rtspProxy::ClientCnx'
scons: *** [Proxy/ClientStream.o] Error 1
scons: building terminated because of errors.
and in RtspController.hh:59 is a forward declaration like this

...
class ClientCnx;
class RtspController : boost::noncopyable
...

and in InterfaceModule.hh there is a class like this:

class PassthroughModule
: public AbstractModule
, public ClientCnx
{
...

Sep 28 '06 #14

P: n/a

first of all: THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX

second: it don´t work yet

third here are all my relevant files and their includes:


main.cc
#include "Proxy/RtspProxy.hh"
RtspProxy.hh
#include "InterfaceModule.hh"
#include "RtspController.hh"
#include "ClientCnx.hh"
#include "ServerCnx.hh"
#include "RtspMsg.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"
#include "Utils/membind.hh"
InterfaceModule.hh
#include "RtspController.hh"
#include "InterfaceList.hh"
RtspController.hh
#include "ClientCnx.hh"
#include "SdpMsg.hh"
#include "RtspMsg.hh"
#include "Scheduler/Scheduler.hh"
#include "Socket.hh"
#include "Utils/Exception.hh"
ClientCnx.hh
#include "InterfaceList.hh"
#include "RtspMsg.hh"
#include "Payload.hh"
#include "ClientStream.hh"
ServerCnx.hh
#include "RtspProxy.hh"
#include "Payload.hh"
#include "InterfaceModule.hh"
#include "ServerStream.hh"
#include "RtspController.hh"
#include "RtspMsg.hh"
#include "InterfaceList.hh"
#include "Socket.hh"
Payload.hh
#include "ServerCnx.hh"
ServerStream.hh
#include "ServerCnx.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"

these are the includes in all headerfiles, some have no includes
my compiler says:

g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o main.o main.cc
g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o Proxy/ClientStream.o Proxy/ClientStream.cc
In file included from Proxy/RtspProxy.hh:50,
from Proxy/ServerCnx.hh:34,
from Proxy/Payload.hh:30,
from Proxy/ClientCnx.hh:34,
from Proxy/ClientStream.hh:33,
from Proxy/ClientStream.cc:23:
Proxy/InterfaceModule.hh:88: error: invalid use of undefined type
`struct satcom::rtspProxy::ClientCnx'
Proxy/RtspController.hh:59: error: forward declaration of `struct
satcom::rtspProxy::ClientCnx'
scons: *** [Proxy/ClientStream.o] Error 1
scons: building terminated because of errors.
and in RtspController.hh:59 is a forward declaration like this

...
class ClientCnx;
class RtspController : boost::noncopyable
...

and in InterfaceModule.hh there is a class like this:

class PassthroughModule
: public AbstractModule
, public ClientCnx
{
...

Sep 28 '06 #15

P: n/a

first of all: THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX THANKX
THANKX THANKX THANKX THANKX THANKX

second: it don´t work yet

third here are all my relevant files and their includes:


main.cc
#include "Proxy/RtspProxy.hh"
RtspProxy.hh
#include "InterfaceModule.hh"
#include "RtspController.hh"
#include "ClientCnx.hh"
#include "ServerCnx.hh"
#include "RtspMsg.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"
#include "Utils/membind.hh"
InterfaceModule.hh
#include "RtspController.hh"
#include "InterfaceList.hh"
RtspController.hh
#include "ClientCnx.hh"
#include "SdpMsg.hh"
#include "RtspMsg.hh"
#include "Scheduler/Scheduler.hh"
#include "Socket.hh"
#include "Utils/Exception.hh"
ClientCnx.hh
#include "InterfaceList.hh"
#include "RtspMsg.hh"
#include "Payload.hh"
#include "ClientStream.hh"
ServerCnx.hh
#include "RtspProxy.hh"
#include "Payload.hh"
#include "InterfaceModule.hh"
#include "ServerStream.hh"
#include "RtspController.hh"
#include "RtspMsg.hh"
#include "InterfaceList.hh"
#include "Socket.hh"
Payload.hh
#include "ServerCnx.hh"
ServerStream.hh
#include "ServerCnx.hh"
#include "Socket.hh"
#include "Scheduler/Scheduler.hh"

these are the includes in all headerfiles, some have no includes
my compiler says:

g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o main.o main.cc
g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o Proxy/ClientStream.o Proxy/ClientStream.cc
In file included from Proxy/RtspProxy.hh:50,
from Proxy/ServerCnx.hh:34,
from Proxy/Payload.hh:30,
from Proxy/ClientCnx.hh:34,
from Proxy/ClientStream.hh:33,
from Proxy/ClientStream.cc:23:
Proxy/InterfaceModule.hh:88: error: invalid use of undefined type
`struct satcom::rtspProxy::ClientCnx'
Proxy/RtspController.hh:59: error: forward declaration of `struct
satcom::rtspProxy::ClientCnx'
scons: *** [Proxy/ClientStream.o] Error 1
scons: building terminated because of errors.
and in RtspController.hh:59 is a forward declaration like this

...
class ClientCnx;
class RtspController : boost::noncopyable
...

and in InterfaceModule.hh there is a class like this:

class PassthroughModule
: public AbstractModule
, public ClientCnx
{
...

Sep 28 '06 #16

P: n/a
bubzilla wrote:
second: it don´t work yet

third: here are all my relevant files and their includes:
[snipped include sections of header files]
>
these are the includes in all headerfiles, some have no includes
my compiler says:

g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o main.o main.cc
g++ -Wall -Woverloaded-virtual -Wno-long-long -pedantic -ansi -O0 -g
-fno-inline -I. -c -o Proxy/ClientStream.o Proxy/ClientStream.cc
In file included from Proxy/RtspProxy.hh:50,
from Proxy/ServerCnx.hh:34,
from Proxy/Payload.hh:30,
from Proxy/ClientCnx.hh:34,
from Proxy/ClientStream.hh:33,
from Proxy/ClientStream.cc:23:
Proxy/InterfaceModule.hh:88: error: invalid use of undefined type
`struct satcom::rtspProxy::ClientCnx'
Proxy/RtspController.hh:59: error: forward declaration of `struct
satcom::rtspProxy::ClientCnx'
scons: *** [Proxy/ClientStream.o] Error 1
scons: building terminated because of errors.
and in RtspController.hh:59 is a forward declaration like this

...
class ClientCnx;
class RtspController : boost::noncopyable
...

and in InterfaceModule.hh there is a class like this:

class PassthroughModule
: public AbstractModule
, public ClientCnx
{
...
Could you post us your whole project (the headers only, and a .cpp file
that uses the same headers as the file that won't compile), or is this
confidential? You can send to my email address, but I'd appreciate you
not to send any further corresponce to this address since my spam filter
will most likely classify English mails as spam (which would be deleted
within one day).

Thanks,
Stuart
Sep 28 '06 #17

P: n/a
thankx so far,

i didn´t forget the "*" for the pointers,
the classes where just a part of my programm and i thought here is the
mistake,
but if the classes compile as you said stuart, the mistake must be
somewhere else in the structure.

Now, i have the same "sub"-structure as your example but i´m always
getting the error if i use the predeclaration.

in Controller i use the predeclaration "class ClientCnx",

if its in in : error:forward declaration of `ClientCnx'

if its not in: error: expected `)' before '*' token ...
so, he needs the class ClientCnx for the pointer

:-(

Sep 28 '06 #18

P: n/a
bubzilla wrote:
ClientCnx.cc
http://rafb.net/paste/results/dgYcY246.html

ClientCnx.hh
http://rafb.net/paste/results/iCFeT751.html

InterfaceModule.hh
http://rafb.net/paste/results/GHS7DG43.html

InterfaceModule.cc
http://rafb.net/paste/results/o1CNvm51.html

RtspController.hh
http://rafb.net/paste/results/0LSmc236.html

RtspController.cc
http://rafb.net/paste/results/YYeetp56.html
There are still a lot of definitions missing, like InterfaceList. I'm
afraid that I'd need to see all these header files (the implementation
files are of no interest to me). Anyway, I won't be back till Wednesday
(national holiday on Tuesday), so you have to wait a bit for answers (I
don't know whether I'll get a opportunity to check my emails this weekend).

Have a nice weekend,
Stuart
Sep 29 '06 #20

This discussion thread is closed

Replies have been disabled for this discussion.