namespace problem

View: New views
4 Messages — Rating Filter:   Alert me  

namespace problem

by Stéphane Conversy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hello,

the following snippet does not compile on MacOSX, with g++4.x:

#include <sigc++/sigc++.h>
using namespace sigc;
signal<void> m;

toto.cc:4: error: expected constructor, destructor, or type conversion  
before ‘<’ token

I thought it was maybe because of <signal.h> or something so I put  
guards before including sigc++/sigc++.h:

#define _USER_SIGNAL_H
#define _BSD_MACHINE_SIGNAL_H_

but it gives the same result. Any tips ?

best regards,

Stéphane Conversy
Enseignant Chercheur en IHM - ENAC
http://lii-enac.fr/~conversy
enac: +33 5 62 17 40 19
dgac r&d: +33 5 62 25 96 48



_______________________________________________
libsigc-list mailing list
libsigc-list@...
http://mail.gnome.org/mailman/listinfo/libsigc-list

Re: namespace problem

by Jonathon Jongsma-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Stéphane Conversy wrote:

> hello,
>
> the following snippet does not compile on MacOSX, with g++4.x:
>
> #include <sigc++/sigc++.h>
> using namespace sigc;
> signal<void> m;
>
> toto.cc:4: error: expected constructor, destructor, or type conversion
> before ‘<’ token
>
> I thought it was maybe because of <signal.h> or something so I put
> guards before including sigc++/sigc++.h:
>
> #define _USER_SIGNAL_H
> #define _BSD_MACHINE_SIGNAL_H_
>
> but it gives the same result. Any tips ?
>
> best regards,
>
> Stéphane Conversy
> Enseignant Chercheur en IHM - ENAC
> http://lii-enac.fr/~conversy
> enac: +33 5 62 17 40 19
> dgac r&d: +33 5 62 25 96 48
>
>
>
> _______________________________________________
> libsigc-list mailing list
> libsigc-list@...
> http://mail.gnome.org/mailman/listinfo/libsigc-list

Does it work if you specify the fully-qualified name (e.g.
sigc::signal<>)?  If so, just use that.  That's what namespaces are for,
after all.  Just drop the 'using namespace ...' stuff.

--
jonner
_______________________________________________
libsigc-list mailing list
libsigc-list@...
http://mail.gnome.org/mailman/listinfo/libsigc-list

Re: namespace problem

by Stéphane Conversy-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes it works with the fully-qualified name, though I'm not satisfied  
with the "drop using namspace" solution:
I tried to compile a program developed on a linux system. I'm not the  
owner of the sources, and the maintainer
said that he "has not interest in supporting propriatory systems",  
which I understand, but makes me unable
to apply your proposition for the sake of other people (it works on my  
system of course).

thanks,

s.

Le 4 sept. 08 à 16:31, Jonathon Jongsma a écrit :

> Stéphane Conversy wrote:
>> hello,
>> the following snippet does not compile on MacOSX, with g++4.x:
>> #include <sigc++/sigc++.h>
>> using namespace sigc;
>> signal<void> m;
>> toto.cc:4: error: expected constructor, destructor, or type  
>> conversion before ‘<’ token
>> I thought it was maybe because of <signal.h> or something so I put  
>> guards before including sigc++/sigc++.h:
>> #define _USER_SIGNAL_H
>> #define _BSD_MACHINE_SIGNAL_H_
>> but it gives the same result. Any tips ?
>> best regards,
>> Stéphane Conversy
>> Enseignant Chercheur en IHM - ENAC
>> http://lii-enac.fr/~conversy
>> enac: +33 5 62 17 40 19
>> dgac r&d: +33 5 62 25 96 48
>> _______________________________________________
>> libsigc-list mailing list
>> libsigc-list@...
>> http://mail.gnome.org/mailman/listinfo/libsigc-list
>
> Does it work if you specify the fully-qualified name (e.g.  
> sigc::signal<>)?  If so, just use that.  That's what namespaces are  
> for, after all.  Just drop the 'using namespace ...' stuff.
>
> --
> jonner

Stéphane Conversy
Enseignant Chercheur en IHM - ENAC
http://lii-enac.fr/~conversy
+33 5 62 17 40 19




_______________________________________________
libsigc-list mailing list
libsigc-list@...
http://mail.gnome.org/mailman/listinfo/libsigc-list

Re: namespace problem

by Ulrich Eckhardt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thursday 28 August 2008, Stéphane Conversy wrote:
> the following snippet does not compile on MacOSX, with g++4.x:
>
> #include <sigc++/sigc++.h>
> using namespace sigc;
> signal<void> m;
>
> toto.cc:4: error: expected constructor, destructor, or type conversion
> before ‘<’ token

Two things come to mind that might cause problems here:
1. signal is a macro
2. signal is another global symbol

Two approaches I use normally are these:

1.
  #define signal 42
  <yourcode>

This will give a warning at the place where the macro is redefined.

2.
  int signal;
  <yourcode>

This will give an error at the place where signal is now redefined as a global
symbol.

Uli


--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

**************************************************************************************
           Visit our website at <http://www.satorlaser.de/>
**************************************************************************************
Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den Adressaten bestimmt und kann vertrauliche Informationen enthalten. Bitte benachrichtigen Sie den Absender umgehend, falls Sie nicht der beabsichtigte Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und darf weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt werden.
E-Mails können durch Dritte gelesen werden und Viren sowie nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese Folgen nicht verantwortlich.

**************************************************************************************

_______________________________________________
libsigc-list mailing list
libsigc-list@...
http://mail.gnome.org/mailman/listinfo/libsigc-list