码迷,mamicode.com
首页 > 编程语言 > 详细

求救:如何在Eclipse IDE for C/C++ Developers中正确编译GTK程序?

时间:2014-10-01 04:32:10      阅读:378      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   for   sp   2014   art   问题   

出现错误信息如下,请问大牛该如何解决?
00:52:56 **** Incremental Build of configuration Debug for project Again ****
make all 
Building file: ../why.c
Invoking: GCC C Compiler
gcc "../why.c" -I/usr/include/glib-2.0 -I/usr/include/atk-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/gtk-2.0 -O0 -g3 -Wall ‘pkg-config --cflags gtk+-2.0‘ -MMD -MP -MF"why.d" -MT"why.d" -o "why.o"
/tmp/cciyb0Cn.o: In function ‘main’:
/home/shw/workspace/Again/Debug/../why.c:5: undefined reference to ‘gtk_init’
/home/shw/workspace/Again/Debug/../why.c:6: undefined reference to ‘gtk_window_new’
/home/shw/workspace/Again/Debug/../why.c:7: undefined reference to ‘gtk_widget_show’
/home/shw/workspace/Again/Debug/../why.c:8: undefined reference to ‘gtk_main’
collect2: ld returned 1 exit status
make: *** [why.o] Error 1


已经安装gtk 2.24.10、Eclipse IDE for C/C++ Developers;已经按<a target=_blank href="http://blog.csdn.net/sunny2038/article/details/7082164">http://blog.csdn.net/sunny2038/article/details/7082164</a> 配置过Eclipse;已经……
还是出错,搜到类似问题<a target=_blank href="http://bbs.chinaunix.net/thread-3775510-1-1.html">http://bbs.chinaunix.net/thread-3775510-1-1.html</a>,但还是改不好,太菜了!求教大牛:如何在Eclipse IDE for C/C++ Developers中正确编译GTK程序? 


测试代码:
#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;
}


求救:如何在Eclipse IDE for C/C++ Developers中正确编译GTK程序?

标签:blog   http   io   ar   for   sp   2014   art   问题   

原文地址:http://blog.csdn.net/acmerhlj/article/details/39706363

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!