简体   繁体   English

mingw32显示对所有gtk函数的未定义引用

[英]mingw32 showing undefined reference to all gtk functions

I am trying to compile the following code, base.c 我正在尝试编译以下代码base.c

#include <glib/gerror.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.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);
}
/* example-end */

I compile it using 我用它编译

gcc -Wall base.c -o base `pkg-config --cflags --libs gtk+-2.0`

The message I get returned in MinGW is 我在MinGW中返回的消息是

C:\\Users\\Sunny\\AppData\\Local\\Temp\\cc4eIpLM.o:base.c:(.text+0x34): undefined reference to gtk_init_abi_check C:\\ Users \\ Sunny \\ AppData \\ Local \\ Temp \\ cc4eIpLM.o:base.c :(。text + 0x34):对gtk_init_abi_check未定义引用

collect2: ld return 1 exit status

I get the same message for gtk_window_new , gtk_widget_show and gtk_main 对于gtk_window_newgtk_widget_showgtk_main我得到相同的消息

I have a feeling it could be to do with the following questions: 我觉得可能与以下问题有关:

1) When compiling c programs with gtk where should I have them saved. 1)当用gtk编译c程序时,我应该在哪里保存它们。 In the mingw folder somewhere? 在mingw文件夹中?

2) I current have this appended onto my system variables path: C:\\gtk\\bin\\;C:\\msys\\1.0\\bin;C:\\mingw\\bin Is it correct? 2)我目前将此附加到我的系统变量路径中: C:\\gtk\\bin\\;C:\\msys\\1.0\\bin;C:\\mingw\\bin这是否正确?

3) mingw32 can not find the libraries. 3)mingw32找不到库。 Is there something I should have done with them when I downloaded msys and mingw 下载msys和mingw时我应该对它们做些什么

Cheers. 干杯。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM