簡體   English   中英

編譯gtk3應用程序時出現致命錯誤:找不到glib.h

[英]Fatal error when compiling gtk3 app: glib.h not found

我試圖編譯gtk3示例程序 ,但不斷出現錯誤。

我已經在Google搜索了大約兩個小時,但找不到解決方案。

命令已通過:

g++ -m64 -std=c++17 ./src/gtkbuildtest.cpp -o ./debug/gtkbuildtest `pkg-config --cflags --libs glib-2.0 gtk+-3.0`

引發錯誤:

In file included from /usr/include/gtk-3.0/gdk/gdk.h:30,
             from /usr/include/gtk-3.0/gtk/gtk.h:30,
             from ./src/globalincludes.hpp:18,
             from ./src/gtkbuildtest.cpp:1:
/usr/include/gtk-3.0/gdk/gdkconfig.h:13:10: fatal error: glib/glib.h: No such file or directory
#include <glib/glib.h>
         ^~~~~~~~~~~~~
compilation terminated.

pkg-config的輸出:

-pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/cairo -I/usr/include/libdrm -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

系統版本:

Ubuntu 18.10

我不知道為什么glib無法正確鏈接。

任何幫助表示贊賞。

我不確定,但是#include <glib.h> (而不是#include <glib/glib.h> )可能會幫助您。 (glib.h不在glib目錄中)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM