Friday Oct 17, 2008

how to compile with gtk on OpenSolaris supplement - install require package

My previous blog  how to compile with gtk on OpenSolaris  mentioned how to compiled gtk application on OpenSolaris. But, actually, if you install OpenSolaris and Sunstudio only, you still can not compile out gtk application, three packages is required for compile/develop gtk application.:

SUNWgnome-common-devel
SUNWxwinc
SUNWxorg-headers

So you need install these three packages by Package Manager or cmd line: pkg install package_name

BTW, There is a discussion about dependencies of these three packages FYI. http://opensolaris.org/jive/thread.jspa?messageID=259469
. also post bugID for it http://defect.opensolaris.org/bz/show_bug.cgi?id=2561

之前的一篇how to compile with gtk on OpenSolaris介绍如何在Opensolaris编译gtk的程序,但是如果你只是装了Opensolaris和Sunstudio的化,仍然无法编译gtk的程序,因为以下三个包也是必须的,可以使用包管理程序或者命令行装上以下三个包即可。
SUNWgnome-common-devel
SUNWxwinc
SUNWxorg-headers

Saturday Oct 11, 2008

how to compile with gtk on OpenSolaris

For people who use gtk+ on OpenSolaris first time. When you compile the application which used gtk+ library, the necessary compile and link options must be used. But for gtk+, the options are too much to list them all. "pkg-config" is useful to help you compile.
This is a simplest gtk application example:

/\*
\* base.c
\*/
#include <gtk/gtk.h>

int main( int argc, char \*argv[] )
{
GtkWidget \*window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
gtk_main ();
return(0);
}

compile as following step: 1>cc -c `pkg-config --cflags gtk+-2.0` base.c 2>cc -o base `pkg-config --libs gtk+-2.0` base.o

About

williamxue

Search

Archives
« July 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  
       
Today