C++ gtkmm头中的声明冲突

C++ gtkmm头中的声明冲突,c++,codeblocks,gtkmm,glibmm,C++,Codeblocks,Gtkmm,Glibmm,我开始觉得我需要放弃一切,从头开始重做。 我一直在代码块编译器设置中手动添加来自GTK和gtkmm的库,当我最终看到除了缺少头以外的其他内容时,我得到了这个 ||=== test, Debug ===| /usr/include/gdkmm-3.0/gdkmm/applaunchcontext.h|32|error: conflicting declaration ‘typedef struct _GdkAppLaunchContext GdkAppLaunchContext’|

我开始觉得我需要放弃一切,从头开始重做。 我一直在代码块编译器设置中手动添加来自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 ===|
有没有办法解决这个问题?
还有,关于如何将这些库添加到库的标准路径的提示吗?为每个项目手动执行此操作将是一个巨大的痛苦。

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

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

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

由于gtkmm没有声明对我能看到的代码::块的任何支持,我建议使用不同的编译器/IDE。这个页面给出了各种Windows环境的说明。不过我是在linux下工作的。我应该注意到这一点,抱歉。不用担心:)thanx不管怎样,你到底在哪里添加了这一行?