gtkmm on windows; "pkg-config gtkmm-4.0 --cflags --libs" get the paths but => fatal error: gtkmm.h: No such file or directory
gtkmm on windows; "pkg-config gtkmm-4.0 --cflags --libs" get the paths but => fatal error: gtkmm.h: No such file or directory
手动编译我现在用的是WindowsPowershell。
我认为路径是正确的:
pkg-config gtkmm-4.0 --cflags --libs
-IC:/msys64/mingw64/bin/../include/gtkmm-4.0 -IC:/msys64/mingw64/bin/../lib/gtkmm-4.0/include -IC:/msys64/mingw64/bin/../include/giomm-2.68 -IC:/msys64/mingw64/bin/../lib/giomm-2.68/include -IC:/msys64/mingw64/bin/../include -IC:/msys64/mingw64/bin/../include/glib-2.0 -IC:/msys64/mingw64/bin/../lib/glib-2.0/include -IC:/msys64/mingw64/bin/../include/glibmm-2.68 -IC:/msys64/mingw64/bin/../lib/glibmm-2.68/include -IC:/msys64/mingw64/bin/../include/sigc++-3.0 -IC:/msys64/mingw64/bin/../lib/sigc++-3.0/include -IC:/msys64/mingw64/bin/../include/gtk-4.0 -IC:/msys64/mingw64/bin/../include/pango-1.0 -IC:/msys64/mingw64/bin/../include/harfbuzz -IC:/msys64/mingw64/bin/../include/freetype2 -IC:/msys64/mingw64/bin/../include/libpng16 -IC:/msys64/mingw64/bin/../include/fribidi -IC:/msys64/mingw64/bin/../include/cairo -IC:/msys64/mingw64/bin/../include/lzo -IC:/msys64/mingw64/bin/../include/pixman-1 -IC:/msys64/mingw64/bin/../include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/bin/../include/graphene-1.0 -IC:/msys64/mingw64/bin/../lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -IC:/msys64/mingw64/bin/../include/cairomm-1.16 -IC:/msys64/mingw64/bin/../lib/cairomm-1.16/include -IC:/msys64/mingw64/bin/../include/pangomm-2.48 -IC:/msys64/mingw64/bin/../lib/pangomm-2.48/include -mms-bitfields -LC:/msys64/mingw64/bin/../lib -lgtkmm-4.0 -lgtk-4 -lpangowin32-1.0 -lcairo-gobject -lgraphene-1.0 -lpangomm-2.48 -lgiomm-2.68 -lgio-2.0 -lglibmm-2.68 -lcairomm-1.16 -lsigc-3.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl
PS
C:\msys64\mingw64\include\gtkmm-4.0> ls
Directorio: C:\msys64\mingw64\include\gtkmm-4.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 29/03/2022 18:21 gdkmm
d----- 29/03/2022 18:21 gtkmm
-a---- 22/03/2022 10:36 1914 gdkmm.h
-a---- 22/03/2022 10:36 10091 gtkmm.h
但是当我尝试编译示例程序时,出现下一个错误:
C:\Programacion\gtk\cmake_test> g++ $(pkg-config gtkmm-4.0 --cflags --libs) base.cc -o simple
base.cc:1:10: fatal error: gtkmm.h: No such file or directory
1 | #include <gtkmm.h>
| ^~~~~~~~~
compilation terminated.
好像g++没有访问路径的权限。
我该如何解决?
提前致谢
已解决:powershell 不会以 unix 风格连接命令,因此 g++ 不能与 $(pkg-config gtkmm-4.0 --cflags --libs)
它通过 msys2-mingw x64 shell 工作,但正确的命令是。
g++ base.cc -o base $(pkg-config gtkmm-4.0 --cflags --libs)
现在它应该与 CMake 一起工作,但那是另一回事了...
手动编译我现在用的是WindowsPowershell。 我认为路径是正确的:
pkg-config gtkmm-4.0 --cflags --libs
-IC:/msys64/mingw64/bin/../include/gtkmm-4.0 -IC:/msys64/mingw64/bin/../lib/gtkmm-4.0/include -IC:/msys64/mingw64/bin/../include/giomm-2.68 -IC:/msys64/mingw64/bin/../lib/giomm-2.68/include -IC:/msys64/mingw64/bin/../include -IC:/msys64/mingw64/bin/../include/glib-2.0 -IC:/msys64/mingw64/bin/../lib/glib-2.0/include -IC:/msys64/mingw64/bin/../include/glibmm-2.68 -IC:/msys64/mingw64/bin/../lib/glibmm-2.68/include -IC:/msys64/mingw64/bin/../include/sigc++-3.0 -IC:/msys64/mingw64/bin/../lib/sigc++-3.0/include -IC:/msys64/mingw64/bin/../include/gtk-4.0 -IC:/msys64/mingw64/bin/../include/pango-1.0 -IC:/msys64/mingw64/bin/../include/harfbuzz -IC:/msys64/mingw64/bin/../include/freetype2 -IC:/msys64/mingw64/bin/../include/libpng16 -IC:/msys64/mingw64/bin/../include/fribidi -IC:/msys64/mingw64/bin/../include/cairo -IC:/msys64/mingw64/bin/../include/lzo -IC:/msys64/mingw64/bin/../include/pixman-1 -IC:/msys64/mingw64/bin/../include/gdk-pixbuf-2.0 -IC:/msys64/mingw64/bin/../include/graphene-1.0 -IC:/msys64/mingw64/bin/../lib/graphene-1.0/include -mfpmath=sse -msse -msse2 -IC:/msys64/mingw64/bin/../include/cairomm-1.16 -IC:/msys64/mingw64/bin/../lib/cairomm-1.16/include -IC:/msys64/mingw64/bin/../include/pangomm-2.48 -IC:/msys64/mingw64/bin/../lib/pangomm-2.48/include -mms-bitfields -LC:/msys64/mingw64/bin/../lib -lgtkmm-4.0 -lgtk-4 -lpangowin32-1.0 -lcairo-gobject -lgraphene-1.0 -lpangomm-2.48 -lgiomm-2.68 -lgio-2.0 -lglibmm-2.68 -lcairomm-1.16 -lsigc-3.0 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lcairo -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl
PS
C:\msys64\mingw64\include\gtkmm-4.0> ls
Directorio: C:\msys64\mingw64\include\gtkmm-4.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 29/03/2022 18:21 gdkmm
d----- 29/03/2022 18:21 gtkmm
-a---- 22/03/2022 10:36 1914 gdkmm.h
-a---- 22/03/2022 10:36 10091 gtkmm.h
但是当我尝试编译示例程序时,出现下一个错误:
C:\Programacion\gtk\cmake_test> g++ $(pkg-config gtkmm-4.0 --cflags --libs) base.cc -o simple
base.cc:1:10: fatal error: gtkmm.h: No such file or directory
1 | #include <gtkmm.h>
| ^~~~~~~~~
compilation terminated.
好像g++没有访问路径的权限。
我该如何解决?
提前致谢
已解决:powershell 不会以 unix 风格连接命令,因此 g++ 不能与 $(pkg-config gtkmm-4.0 --cflags --libs)
它通过 msys2-mingw x64 shell 工作,但正确的命令是。
g++ base.cc -o base $(pkg-config gtkmm-4.0 --cflags --libs)
现在它应该与 CMake 一起工作,但那是另一回事了...