[gst-devel] c++ patch

Tim 'Tool-Man' Taylor tim at tool-man.org
Wed Mar 7 02:55:00 CET 2001

Matt Howell wrote:
 > tim -
 > i believe brentb checked in fixes (tag RELEASE-0_1_1-DUCTTAPE)
 > for these about 9 days ago.  (the version of your gstcaps.h should be 
 > you should have following snippet at the top of the file:

I should have mentioned in my first post that I did a cvs update. 
Anyhow, just to be sure I wasn't fouling myself up with sticky tags, I did:

$ cvs -z3 update -A
$ cvs -z3 update -dP


> typedef struct _GstCaps GstCaps;
> typedef gpointer GstCapsFactoryEntry;
> #ifdef __cplusplus
> typedef GstCapsFactoryEntry * GstCapsFactory;
> #else // C++ was unable to compile with this
> typedef GstCapsFactoryEntry GstCapsFactory[];
> #endif

gstcaps.h is 1.18 and contains those lines.  Still, I get the same error.
To eliminate as many factors as possible, I created this minimal C++

#include <stream.h>
extern "C" {
    #include <stdlib.h>
    #include <gst/gst.h>

class Foo {
        void main(int argc, char *argv[]);

void Foo::main(int argc, char *argv[]) {
    cout << "Foo" << endl;

int main(int argc, char *argv[]) {
    Foo *foo = new Foo();
    foo->main(argc, argv);

Compiling Foo.cc with gcc 3.0 I get the same errors as before.  Compiling
with gcc 2.91 (egcs-1.1.2) I get these errors:

$ g++ -I/usr/include -I/usr/lib/glib/include -I/usr/X11R6/include
-I/usr/include/gnome-xml -I/opt/gstreamer-cvs/include -D_REENTRANT 
-fPIC Foo.cc -o Foo
/opt/gstreamer-cvs/include/gst/gstinfo.h: In function `gchar * _gst_debug_nameof_funcptr(void *)':
In file included from /opt/gstreamer-cvs/include/gst/gst.h:29,
                 from Foo.cc:6:
/opt/gstreamer-cvs/include/gst/gstinfo.h:142: warning: ANSI C++ forbids implicit conversion from `void *' in initialization
/opt/gstreamer-cvs/include/gst/gstcaps.h: At top level:
In file included from /opt/gstreamer-cvs/include/gst/gstpad.h:39,
                 from /opt/gstreamer-cvs/include/gst/gst.h:31,
                 from Foo.cc:6:
/opt/gstreamer-cvs/include/gst/gstcaps.h:65: parse error before `typeid'

Tim Taylor
tim at tool-man.org

More information about the gstreamer-devel mailing list