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.
Asked
Active
Viewed 1,257 times
0
-
1sublime text is a text editor not an IDE – dparoli Apr 02 '17 at 11:29
-
1@dparoli You can still get sublime to launch the compiler though by either using Make or sublime's format. – TheBlueCat Apr 02 '17 at 12:25
-
my fault, I didnt know of sublime format – dparoli Apr 02 '17 at 15:56
2 Answers
1
it's Been a while.
For those who stumble upon this..
Try the following:
- click 'Tools' tab > 'Build System' > 'New Build System...'
- 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" }
- 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