After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 155304 - pygobject.h cannot be included in C++ programs
pygobject.h cannot be included in C++ programs
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
2.9.0
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
: 156341 301803 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-10-13 13:40 UTC by humufr
Modified: 2006-01-09 14:12 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description humufr 2004-10-13 13:40:14 UTC
install pygtk (debian sid 2.4)

try to compile the file:

//test.cpp
#include <cstring>
#include <cerrno>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <utility>

#include <pygobject.h>

int main() {
  std::cout << "hello gtk" << std::cout;
}

I obtain the error:

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes
-fPIC   -I/usr/local/include -I/usr/include -I/usr/include/pygtk-2.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-2.0
-I/usr/lib/gtk-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/python2.3 -c test.cpp
In file included from /usr/include/python2.3/Python.h:8,
                from /usr/include/pygtk-2.0/pygobject.h:5,
                from test.cpp:8:
/usr/include/python2.3/pyconfig.h:856:1: warning: "_POSIX_C_SOURCE" redefined
In file included from /usr/include/string.h:26,
                from /usr/include/c++/3.3/cstring:51,
                from test.cpp:1:
/usr/include/features.h:131:1: warning: this is the location of the previous
definition
In file included from test.cpp:8:
/usr/include/pygtk-2.0/pygobject.h:140: error: parse error before `typename'
/usr/include/pygtk-2.0/pygobject.h:147: error: parse error before `typename'


I'm using gcc-3.3.5:

> gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib
--enable-nls --without-included-gettext --enable-__cxa_atexit
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.5 (Debian 1:3.3.5-1)
Comment 1 Gustavo Carneiro 2004-10-13 20:15:22 UTC
Problem was that the parameter 'typename' is a C++ keyword.  Just in case, I
also added G_BEGIN_DECLS / G_END_DECLS

http://cvs.gnome.org/viewcvs/gnome-python/pygtk/gobject/pygobject.h?r1=1.44&r2=1.45&diff_format=u
Comment 2 Johan (not receiving bugmail) Dahlin 2004-10-25 00:03:51 UTC
*** Bug 156341 has been marked as a duplicate of this bug. ***
Comment 3 Gustavo Carneiro 2005-04-24 16:40:32 UTC
*** Bug 301803 has been marked as a duplicate of this bug. ***