怎么样Eclipse IDE for C/C++ Developers正确编译GTK规划?(解决)

怎么样Eclipse IDE for C/C++ Developers正确编译GTK规划?(解决)

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

<span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 25.99431800842285px;  background-color: rgb(240, 240, 240);"><strong>(</strong></span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; background-color: rgb(240, 240, 240); line-height: 25.99184799194336px;"><strong>已解决,详见<a target=_blank target="_blank" href="http://blog.csdn.net/acmerhlj/article/details/39720183" style="color: rgb(0, 0, 0); text-decoration: none; font-family: 'Microsoft YaHei'; line-height: 30px;">Ubuntu 12.04下在Eclipse IDE for C/C++ Developers中执行C语言的GTK程序</a></strong></span><span style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 25.99431800842285px;  background-color: rgb(240, 240, 240);"><strong>)</strong></span>
出现错误信息例如以下,请问大牛该怎样解决?<strong><span style="font-size:14px;">(<span style="color: rgb(51, 51, 51); font-family: Arial; line-height: 25.99184799194336px;">已解决,详见<a target=_blank href="http://blog.csdn.net/acmerhlj/article/details/39720183" style="color: rgb(0, 0, 0); text-decoration: none; font-family: 'Microsoft YaHei'; line-height: 30px;">Ubuntu 12.04下在Eclipse IDE for C/C++ Developers中执行C语言的GTK程序</a></span>)</span></strong>
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


已经安装Ubuntu(ubuntu-12.04-desktop-i386)、gtk 2.24.10、Eclipse IDE for C/C++ Developers(eclipse-cpp-luna-R-linux-gtk.tar);<span style="font-family: Arial, Helvetica, sans-serif;">在终端能够编译并显示用C写的gtk窗体,在Eclipse里能编译普通的C/C++程序。</span>已经按http://blog.csdn.net/sunny2038/article/details/7082164的方法配置过Eclipse;已经……<span style="font-family: Arial, Helvetica, sans-serif;">包括非常多的头文件是由于提示找不到各个头文件,也尝试设置PKG_CONFIG_PATH。</span>还是出错,搜到相似问题(http://bbs.chinaunix.net/thread-3775510-1-1.html。http://bbs.csdn.net/topics/380110411),但还是改不好,太菜了!Ubuntu环境变量的设置是硬伤!求教大牛:怎样才干在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;
}






版权声明:本文博主原创文章。博客,未经同意不得转载。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/116778.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)


相关推荐

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号