[gtkmm] confusing between Interface class in global space and Glib::Interfaceclass

F

Fautvoir

The include files of gtkmm define a class named Glib::Interface.

My application defines a class in the global space named Interface.

I use this class Interface like this :


1) definition of class B :

#include <gtkmm.h>

class interface;
class C;

class B : public Gtk::Window // Gtk::Window est defined in gtkmm.h and
//the behind stuff.

{
Interface * interface;
C* cc;
....
};

Definition of class C :

class Interface;

class C
{

Interface * function();
....
};

In the constructor of B

#include "C.hh"

B::B(C* ccc) :
cc(ccc)
{
interface = cc->fonction(); // does't work with the following
//message on compiling time :
...
}

CMakeFiles/gestionnaire.dir/Gestion/IHM/Fenetre_principale.o
/home/thierry/Circuit/Gestion/IHM/Fenetre_principale.cc: In constructor
'Fenetre_principale::Fenetre_principale(Services*)':
/home/thierry/Circuit/Gestion/IHM/Fenetre_principale.cc:37: error:
cannot convert 'Interface*' to 'Glib::Interface*' in assignment

The class C definition gives the return value type of the C::function as
Glib::Interface then the definition of the class B makes the attribut
B.interface as Interface type.

I never ask to use the Glib namespace in any file,
I don't find any statement "using namespace xxx;" in the include files
of gtkmm (fine !!).

I don't understand why.

Thank for help.
 
A

Alf P. Steinbach

* Fautvoir:
The include files of gtkmm define a class named Glib::Interface.

My application defines a class in the global space named Interface.

I use this class Interface like this :


1) definition of class B :

#include <gtkmm.h>

class interface;

Should be initial uppercase, probably.

class C;

class B : public Gtk::Window // Gtk::Window est defined in gtkmm.h and
//the behind stuff.

{
Interface * interface;

Try

::Interface* interface;

C* cc;
....
};

Definition of class C :

class Interface;

class C
{

Interface * function();
....
};

In the constructor of B

#include "C.hh"

B::B(C* ccc) :
cc(ccc)
{
interface = cc->fonction(); // does't work with the following
//message on compiling time :

Should probably be 'function'.

...
}

CMakeFiles/gestionnaire.dir/Gestion/IHM/Fenetre_principale.o
/home/thierry/Circuit/Gestion/IHM/Fenetre_principale.cc: In constructor
'Fenetre_principale::Fenetre_principale(Services*)':
/home/thierry/Circuit/Gestion/IHM/Fenetre_principale.cc:37: error:
cannot convert 'Interface*' to 'Glib::Interface*' in assignment

The class C definition gives the return value type of the C::function as
Glib::Interface then the definition of the class B makes the attribut
B.interface as Interface type.

I never ask to use the Glib namespace in any file,
I don't find any statement "using namespace xxx;" in the include files
of gtkmm (fine !!).

I don't understand why.

Thank for help.

Please read the FAQ items on posting questions about code that doesn't work.

In particular, note that we're not telepaths (this should probably be a FAQ: Q:
"Are clc++ respondents telepaths?" A: "No, they're not"): we can't see the
*actual* code when you choose to not provide it, even if you're thinking of it.

I don't understand why so many people think that those who read their articles
must be telepaths, but, I've lamented over that umpteen times before, so if it's
any consolation: you're absolutely not alone in that (erroneous) belief.


Cheers & hth.,

- Alf
 
F

Fautvoir

Alf P. Steinbach a écrit :
* Fautvoir:


Should be initial uppercase, probably.

Yes, it is
Try

::Interface* interface;

Yes, I did, i would like to undrestand why I have to
Should probably be 'function'.
yes

Please read the FAQ items on posting questions about code that doesn't
work.

In particular, note that we're not telepaths (this should probably be a
FAQ: Q: "Are clc++ respondents telepaths?" A: "No, they're not"): we
can't see the *actual* code when you choose to not provide it, even if
you're thinking of it.
OK; I'am sorry, I read the FAQ before, but the actual code seems to be
to big for a post and comments are in french. So the translation could
be confusing (see above).
I don't understand why so many people think that those who read their
articles must be telepaths, but, I've lamented over that umpteen times
before, so if it's any consolation: you're absolutely not alone in that
(erroneous) belief.


Cheers & hth.,

- Alf

Thank for your answer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top