SOS: How do I compile the GTK program correctly in Eclipse IDE for C + + developers?

Source: Internet
Author: User
Tags gtk


The error message is as follows. How can Daniel solve it?
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 and eclipse IDE for C / C + + developers have been installed; eclipse has been configured by pressing < a target = ﹐ blank href = "http://blog.csdn.net/sunny2038/article/details/7082164" > http://blog.csdn.net/sunny2038/article/details/7082164 < / a >
It's still an error. I found a similar problem < a target = _blankhref = "http://bbs.chinaunix.net/thread-3775510-1-1. HTML" > http://bbs.chinaunix.net/thread-3775510-1-1. HTML < / a >, but it's not good to change. It's too delicious! How to compile GTK program correctly in eclipse IDE for C / C + + developers?
Test code:
#include <gtk/gtk.h>
int main( int argc, char *argv[] )
{
GtkWidget *window;
gtk_init (&amp;argc, &amp;argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_show (window);
Gtk_main ();
Return 0;
}

SOS: How do I compile the GTK program correctly in Eclipse IDE for C + + developers?


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.