c++codeblocksgtkmmglibmm

Conflicting declarations in gtkmm headers


I'm beginning to think I need to scrap everything and redo it from scratch. I've been manually adding libraries from GTK and gtkmm in the codeblocks compiler settings, when I finally see something else than missing header, I get this.

    ||=== test, Debug ===|
   /usr/include/gdkmm-3.0/gdkmm/applaunchcontext.h|32|error: conflicting declaration ‘typedef struct _GdkAppLaunchContext GdkAppLaunchContext’|
   /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h|42|error: ‘GdkAppLaunchContext’ has a previous declaration as ‘typedef struct GdkAppLaunchContext GdkAppLaunchContext’|
   /usr/include/gdkmm-3.0/gdkmm/applaunchcontext.h|33|error: conflicting declaration ‘typedef struct _GdkAppLaunchContextClass GdkAppLaunchContextClass’|
   /usr/include/gtk-2.0/gdk/gdkapplaunchcontext.h|43|error: ‘GdkAppLaunchContextClass’ has a previous declaration as ‘typedef struct GdkAppLaunchContextClass GdkAppLaunchContextClass’|
   /usr/include/gdkmm-3.0/gdkmm/rgba.h|251|error: return type ‘Gdk::RGBATraits::CType {aka struct _GdkRGBA}’ is incomplete|
   /usr/include/gdkmm-3.0/gdkmm/rgba.h|252|error: return type ‘Gdk::RGBATraits::CType {aka struct _GdkRGBA}’ is incomplete|
   /usr/include/gtkmm-3.0/gtkmm/widget.h|3890|error: ‘GdkEventTouch’ was not declared in this scope|
   /usr/include/gtkmm-3.0/gtkmm/widget.h|3890|error: template argument 2 is invalid|
   ||=== Build finished: 8 errors, 0 warnings ===|

any ideas on how I can solve this? also, any tips on how to add these libraries to the standard path for libraries? doing this manually for every project will be a huge pain.


Solution

  • I solved it. instead of adding the header directories under the compiler's search directories. I added the following line:

        `pkg-config --libs --cflags gtkmm-3.0`
    

    to other options under both compiler and linker in codeblocks. that solved all conflicts and allowed me to run my test program finally.