马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 polt 于 2018-9-3 08:35 编辑 #include <stdio.h>
#include <gtk/gtk.h>
int main(){
gtk_init(NULL,NULL);
GtkWidget*window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(window,"你好");
g_signal_connect(window,"destroy",gtk_main_quit,NULL);
gtk_widget_show(window);
get_main();
return 0;
}
代码是这样的,只是调用gtk完成个图形界面,然后就报下面两行错误
C:\Users\ADMINI~1\AppData\Local\Temp\ccOLfn6O.o:gtk1.c:(.text+0x9f): undefined reference to `get_main'
collect2.exe: error: ld returned 1 exit status
这两行的报错我在网上查了一下,说是用c编译器编译c++程序才会出现这种情况,但是gtk是纯C的图形库,应该不会出现这种情况,有没有大神能给答疑解惑
编译选项是这样的
gcc gtk1.c -w -o gtk1.exe -ID:\gtk\include -ID:\gtk\include\gtk-3.0 -ID:\gtk\include\cairo -ID:\gtk\include\gdk -ID:\gtk\include\glib-2.0 -ID:\gtk\lib\glib-2.0\include -ID:\gtk\include\pango-1.0 -ID:\gtk\include\atk-1.0 -ID:\gtk\include\gdk-pixbuf-2.0 -LD:\gtk\lib -lgtk-win32-3.0 -lgobject-2.0 -lglib-2.0 -lgdk-win32-3.0 -lgdk_pixbuf-2.0 -lcairo -mwindows |