1

我开始认为我需要废弃所有东西并从头开始重做。我一直在代码块编译器设置中手动添加来自 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 ===|

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

4

1 回答 1

3

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

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

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

于 2013-04-18T18:34:23.033 回答