GNOME Bugzilla – Bug 680241
Instructions on how to build a GTK app won't work with recent GCC versions
Last modified: 2013-06-20 22:55:16 UTC
From http://developer.gnome.org/gtk3/stable/gtk-compiling.html <pre>cc `pkg-config --cflags --libs gtk+-3.0` hello.c -o hello</pre> I you follow these instructions, you'll have errors on recent GCC versions: http://stackoverflow.com/questions/11546877/compiling-and-linking-gtk-3-with-c-project-on-ubuntu This should be replaced by: <pre>cc hello.c `pkg-config --cflags --libs gtk+-3.0` -o hello</pre>
Hey Luis, thanks for the report; that documentation is from GTK+, I'm reassigning.
Created attachment 228896 [details] [review] reorder compiler command line in documentation
Review of attachment 228896 [details] [review]: ::: docs/reference/gtk/compiling.sgml @@ +43,3 @@ a GTK+ Hello, World, you would type the following: <programlisting> +$ cc hello.c `pkg-config --cflags --libs gtk+-3.0` -o hello I'd rather have the portable version, i.e.: cc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs gtk+-3.0` given that it'll work on Windows as well.
Created attachment 228902 [details] [review] updated patch with more compatible ordering Thanks for the review, I updated the patch.
(In reply to comment #3) > I'd rather have the portable version, i.e.: > > cc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs > gtk+-3.0` > > given that it'll work on Windows as well. Any reference on that ? I'm not aware of differences on behavior here between Linux and Windows. Another thing is the possibility of using the $() notation instead of backticks. Newcommers often don't recognize the backticks and use normal single quotes, so the $() notation would be better, but I'm not sure it is supported by all shells. What do you think?
About $() vs backticks, it seems every POSIX-compliant shell would allow the use of $(), so I would go for it: http://unix.stackexchange.com/questions/5778/whats-the-difference-between-stuff-and-stuff
Review of attachment 228902 [details] [review]: sure
(In reply to comment #5) > (In reply to comment #3) > > I'd rather have the portable version, i.e.: > > > > cc `pkg-config --cflags gtk+-3.0` hello.c -o hello `pkg-config --libs > > gtk+-3.0` > > > > given that it'll work on Windows as well. > > Any reference on that ? I'm not aware of differences on behavior here between > Linux and Windows. For the record, this is has been confirmed by Tor Lillqvist too: https://mail.gnome.org/archives/gtk-app-devel-list/2010-February/msg00035.html