我試圖編譯在PowerShell中GTK程序,這樣我可以使用pkg配置的輸入輸出GCC但GCC走的是全輸出作爲一個單一的命令行選項和返回錯誤:爲什麼gcc只將它解釋爲單一選項?
gcc.exe: error: unrecognized command line option '-mms-bitfields -pthread -mms-bitfields -IC:/gtk/include/gtk-3.0 -IC tk/include/cairo -IC:/gtk/include -IC:/gtk/include/pango-1.0 -IC:/gtk/include/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk clude/pixman-1 -IC:/gtk/include -IC:/msys/opt/include -IC:/msys/opt/include/freetype2 -IC:/msys/opt/include -IC:/msys t/include/libpng16 -IC:/gtk/include -IC:/gtk/include/freetype2 -IC:/gtk/include -IC:/gtk/include/libpng16 -IC:/gtk/in de/gdk-pixbuf-2.0 -IC:/gtk/include/libpng16 -IC:/gtk/include/glib-2.0 -IC:/gtk/lib/glib-2.0/include -LC:/gtk/lib -lgt -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lsetupapi -lcfgmgr32 -lz -lpangowin32-1.0 -lp ocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl'
我使用的命令行:
gcc hello.c -o hello $(pkg-config.exe --cflags --libs gtk+-3.0)
我也試過:
$(gcc hello.c -o hello $(pkg-config.exe --cflags --libs gtk+-3.0))
要麼返回相同的結果。我該如何解決?
'gcc hello.c -o hello' - %'$(pkg-config.exe --cflags --libs gtk + -3.0)' – PetSerAl
工作很好,謝謝。您可以將其發佈爲答案,以便我可以接受。 – Jack