Re: Using gtk+ in Xcode



On Thu, Jul 03, 2014 at 05:34:08PM +0300, Hind Noor wrote:
Hello,

Hi.

I have 2 questions:

  1- Can  gtk+ be used inside Xcode? I like to write, compile, link, and run my project via Xcode NOT via 
the command line terminal.

Yes. GTK+ is just another library so from Xcodes point of view using it
is no different from using any other library. What is comes down to is
that you have to specify the compile and linker flags in your Xcode
build settings. If I remember correctly those build settings are called
"Other C Flags" and "Other Linker Flags" respectively.

There's an excellent tool called pkg-config which can help you with the
build flags. Run pkg-config --cflags gtk+-3.0 for the compile flags and
pkg-config --libs gtk+-3.0 for the linker flags. I'm not sure if Xcode
can interpolate shell commands its build settings, otherwise you will
have to copy and paste the output from pkg-config.

  2- I installed gtk+ via Homebrew and it downloaded and installed all the required dependencies:

  Libraries directory for gtk+ and glib etc .. : /usr/local/lib/
  headers directory for gtk+: /usr/local/include/

How can i compile sample.c file under Mac OSX? what should i write in the terminal?

Something like this, but I don't know exactly what sample.c is.

clang -o sample $(pkg-config --cflags --libs gtk+-3.0) sample.c


                Marcus


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]