gcc raises “unrecognized command line option” error with pkg-config

冷暖自知 提交于 2021-02-07 10:24:25

问题


I am trying to compile a gtk program using the tutorial here. When I issue the command

gcc -o tut tut.c $(pkg-config --cflags --libs gtk+-2.0 gmodule-2.0)

I get the following error:

gcc: error: unrecognized command line option ‘-pthread -I/usr/include/gtk-2.0
-I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0
-I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0
-I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1
-I/usr/include/libpng12 -I/usr/include/harfbuzz  -Wl,--export-dynamic -pthread
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0
-lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lfreetype
-lgmodule-2.0 -lglib-2.0  ’

gcc is version 4.8.2. pkg-config is version 0.26. i have libgtk2.0-dev installed.

I can compile simple c programs fine.

How do I resolve the "unrecognized command" problem?


[update from comment]

I am using zsh.


回答1:


This looks like a shell issue.

What shell are you using?

In case it's not bash, give bash a try.



来源:https://stackoverflow.com/questions/24350919/gcc-raises-unrecognized-command-line-option-error-with-pkg-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!