Re: Compiling glib applications
- From: Dan Williams <dcbw redhat com>
- To: Lanoxx <lanoxx gmx net>
- Cc: desktop-devel-list <desktop-devel-list gnome org>
- Subject: Re: Compiling glib applications
- Date: Thu, 09 Aug 2012 13:20:39 -0500
On Thu, 2012-08-09 at 14:46 +0200, Lanoxx wrote:
> Today I was writing some simple glib application and had a look at
> this page [1], to get some advice on how to compile and link my
> program with glib. However for me the advice was not entirely correct,
> since it give this example line:
> > cc `pkg-config --cflags --libs glib-2.0` hello.c -o hello
> I adjusted it a bit to my file names and added c99 support:
>
> gcc `pkg-config --cflags glib-2.0` `pkg-config --libs glib-2.0`
> main.c -o main --std=c99
>
> But it turns out this is wrong, and the correct way is:
>
> gcc main.c `pkg-config --cflags glib-2.0` `pkg-config --libs
> glib-2.0` -o main --std=c99
Or, more simply:
gcc main.c `pkg-config --libs --cflags glib-2.0 <other-lib> <another-lib>` -o main.c
No need to have multiple pkg-config invocations at all; one does just
fine.
Dan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]