GTK Project is not working

General questions regarding the usage of CodeLite
Valentine
CodeLite Curious
Posts: 4
Joined: Sun Sep 14, 2014 7:50 am
Genuine User: Yes
IDE Question: c++
Contact:

GTK Project is not working

Post by Valentine »

Hi,

I wanted to try Codelite for C/C++ but there is a problem which is annoying.

The MinGW which is comes with Codelite doesn't have GTK and it has'nt any terminal or something like that. So when i tried to compile , it gives me :

Code: Select all

gcc.exe: error: `pkg-config: No such file or directory
gcc.exe: error: gtk+-2.0`: No such file or directory
gcc.exe: error: unrecognized command line option '--cflags'
mingw32-make.exe[1]: *** [Debug/main.c.o.d] Error 1
mingw32-make.exe: *** [All] Error 2
so what can i do for this, any ideas ?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: GTK Project is not working

Post by eranif »

You can modify the project settings and provide the GTK arguments needed on Windows.
On Linux the proper way to do this, is to use the `pkg-config` tool

it seems that the templates are meant to be used on Linux only (tbh, I tested them on Linux only)

To update the project settings:
Right click on your project->common settings->compiler and remove the pkg-config option set there and replace it with the proper include directories + definitions
Same thing should be done in the linker settings

Eran
Make sure you have read the HOW TO POST thread
Valentine
CodeLite Curious
Posts: 4
Joined: Sun Sep 14, 2014 7:50 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: GTK Project is not working

Post by Valentine »

@eranif

First of all, thank you for attention but I'm a pretty newbie at this stuff and i dont know what did you mean exactly. By the way on linux it works just fine .

I have gtk which is work perfect with codeblock, i mean its able to work. And it's on ' C:\gtk ' i can delete pkg-config --flags from CodeLite but here is the problem , how can i add libraries to CodeLite and which ones should i add.

I did try , add gtk(all of it) to mingw(in codelite) but it didn't change anything.

thanks again...
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: GTK Project is not working

Post by eranif »

Valentine wrote: By the way on linux it works just fine .
Yes, this is what I wrote - I only tested it on Linux.

A quick google search yield this document:

http://www.gtk.org/download/win32_tutorial.php - which seems to include a working pkg-config for Windows

Eran
Make sure you have read the HOW TO POST thread
Valentine
CodeLite Curious
Posts: 4
Joined: Sun Sep 14, 2014 7:50 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: GTK Project is not working

Post by Valentine »

eranif wrote:
Valentine wrote: By the way on linux it works just fine .
Yes, this is what I wrote - I only tested it on Linux.

A quick google search yield this document:

http://www.gtk.org/download/win32_tutorial.php - which seems to include a working pkg-config for Windows

Eran
I already did that , is that supposed to fix that ? if it is still have a problem which is annoying :roll:
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: GTK Project is not working

Post by eranif »

There seems to be a problem with the way backticks are handled by the Makefile.
So, here is a short tutorial on how to make it work:
  • Download the All-In-One GTK3 Bundle
  • Extract the zip file (for this example, I will assume that you have installed it under: C:\src\gtk)
  • Open codelite and define a GTK3.0/C project
  • Open project settings->common settings->compiler and replace this:

    Code: Select all

    `pkg-config --cflags gtk+-3.0`
    with this line:

    Code: Select all

    $(shell pkg-config --cflags gtk+-3.0)
  • Open project settings->common settings->linker and replace this:

    Code: Select all

    `pkg-config --libs gtk+-3.0`
    with this line:

    Code: Select all

    $(shell pkg-config --libs gtk+-3.0)
  • Add GTK bin folder into the path, from the codelite's main menu: settings->environment variables
    And add this line:

    Code: Select all

    PATH=C:\src\gtk\bin;$PATH
    NOTE: Replcae C:\src\gtk with your installation path
  • Compile and run it
Eran
Make sure you have read the HOW TO POST thread
Valentine
CodeLite Curious
Posts: 4
Joined: Sun Sep 14, 2014 7:50 am
Genuine User: Yes
IDE Question: c++
Contact:

Re: GTK Project is not working

Post by Valentine »

eranif wrote:There seems to be a problem with the way backticks are handled by the Makefile.
So, here is a short tutorial on how to make it work:
  • Download the All-In-One GTK3 Bundle
  • Extract the zip file (for this example, I will assume that you have installed it under: C:\src\gtk)
  • Open codelite and define a GTK3.0/C project
  • Open project settings->common settings->compiler and replace this:

    Code: Select all

    `pkg-config --cflags gtk+-3.0`
    with this line:

    Code: Select all

    $(shell pkg-config --cflags gtk+-3.0)
  • Open project settings->common settings->linker and replace this:

    Code: Select all

    `pkg-config --libs gtk+-3.0`
    with this line:

    Code: Select all

    $(shell pkg-config --libs gtk+-3.0)
  • Add GTK bin folder into the path, from the codelite's main menu: settings->environment variables
    And add this line:

    Code: Select all

    PATH=C:\src\gtk\bin;$PATH
    NOTE: Replcae C:\src\gtk with your installation path
  • Compile and run it
Eran
That Worked ! god bless you. :lol:
Post Reply