GTK编译与调试

说明:文档里提到的work是在跟目录下的:/work


/work
一: gtk debug 版本编译:
假定你把gtk+-2.20.0库放在/work/gtk+-2.20.0/目录下面。
1. root@ubuntu:/work/gtk+-2.20.0/# ./configure --enable-debug=yes –without-libtiff
        note:如果提示找不到glib-2.0 ,可以运行 apt-get install glib* 命令安装。
2.  root@ubuntu:/work/gtk+-2.20.0/#  make
3. root@ubuntu:/work/gtk+-2.20.0/#  export LD_LIBRARY_PATH=/work/gtk+-2.20.0/gtk/.libs:/work/gtk+-2.20.0/gdk/.libs/
4. root@ubuntu:/work/gtk+-2.20.0/#  set solib-search-path /work/gtk+-2.20.0/gtk/.libs:/work/gtk+-2.20.0/gdk/.libs/

然后把在你自己想调试的应用程序编译的时候编译成debug模式,在你自己的程序就可以跟到gtk或者gdk库里面了。如果有跟不到的库,那就编 译相应的库,把相应库的路径设置上,通过set solib-search-path $Your so libraru path$。




 using ./examples/helloworld for example.
 5.  root@ubuntu:/work/gtk+-2.20.0/#   cd ./examples/helloworld
 6.  edit Makefile. add debug info to application.
      Change Line 11: $(CC) helloworld.c  -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
       to           $(CC) helloworld.c  -g -o helloworld $(CFLAGS) `pkg-config gtk+-2.0 --cflags --libs`
 7.root@ubuntu:/work/gtk+-2.20.0/examples/helloworld# make


 8 root@ubuntu:/work/gtk+-2.20.0/examples/helloworld# gdb helloworld
        (gdb) b 88
                 Breakpoint 1 at 0x8048b67: file helloworld.c, line 88.
        (gdb) r
        Breakpoint 1, main (argc=1, argv=0xbffff324) at helloworld.c:88
88        gtk_widget_show (button);




ps: gdb commands:
       b:breakpoint
       s: step into
       n: next
       bt : print call stacks
       l: list code

你可能感兴趣的:(ubuntu,Path,library,button,BT,gtk)