gtkmm标头中的冲突声明

时间:2013-04-18 09:20:53

标签: c++ codeblocks gtkmm glibmm

我开始认为我需要废弃所有内容并从头开始重做。 我一直在代码块编译器设置中手动添加GTK和gtkmm中的库,当我终于看到别的东西而不是缺少标题时,我明白了。

    ||=== 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 ===|

关于如何解决这个问题的任何想法? 还有,关于如何将这些库添加到库的标准路径的任何提示?为每个项目手动执行此操作将是一个巨大的痛苦。

1 个答案:

答案 0 :(得分:3)

我解决了。而不是在编译器的搜索目录下添加头目录。 我添加了以下行:

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

到codeblocks中编译器和链接器下的其他选项。这解决了所有冲突,并允许我最终运行我的测试程序。

相关问题