0

I'm learning c programming language. Almost I completed all the syntaxes and example programs. I want to create graphical user interface for the source code written in C. A lot of browsing in google I found that it is possible with gtk+. Now I'm using Sublime Text 3 to write and compile my C programs. Is there any way to add gtk+ with the sublimt text.

2 Answers2

1

it's Been a while.

For those who stumble upon this..

Try the following:

  1. click 'Tools' tab > 'Build System' > 'New Build System...'
  2. in the file add the following:
{
  "shell_cmd":"gcc `pkg-config --cflags gtk+-3.0` -o $file_base_name $file `pkg-config --libs gtk+-3.0`",
"selector":"source.c",
"working_dir":"$file_path"
}
  1. save file with reasonable name. keeping in mind that this compiles for gtk3.0.

Note: this only compiles the current active single file.

Note 2: only tested in ST3.

mrtubbs
  • 36
  • 2
0

You can use Make if you have it installed on your system. Or if it's just a single .c file, you can quickly use the command line. See this questions on how to compile and run C programs from within sublime text.

To get the CFLAGS and linking flags use:

pkg-config gtk+-3.0 --cflags --libs

As you have not stated the OS you are using I am going to assume Linux, or some Unix.

then:

gcc -Wall -Wpedantic -Wextra -g $(pkg-config gtk+-3.0 --cflags --libs) gtk.c -o gtk
Community
  • 1
  • 1
TheBlueCat
  • 1,147
  • 5
  • 19
  • 38
  • Thanks for the reply. My os is windows 7. I'm just a beginner. I can't understand anything in the reply you have given. Can you please guide me with a step by step procedure.:-) – Nikilesh Sai Apr 02 '17 at 12:35