gtk在windows 10下工作吗

gtk在windows 10下工作吗,gtk,mingw,gtk3,msys2,Gtk,Mingw,Gtk3,Msys2,我已经在Windows 10/Surface Pro 2上安装了MinGW64(MSYS2)。然后我用pacman安装了GTK3和许多其他软件包,都是64位版本。我甚至能够运行gtk3演示,并弹出一个窗口。但是,我不能得到一个简单的c程序来编译 节目: #include <gtk/gtk.h> void on_window_destroy (GtkWidget *widget, gpointer user_data) { gtk_main_quit (); /*

我已经在Windows 10/Surface Pro 2上安装了MinGW64(MSYS2)。然后我用pacman安装了GTK3和许多其他软件包,都是64位版本。我甚至能够运行gtk3演示,并弹出一个窗口。但是,我不能得到一个简单的c程序来编译

节目:

#include <gtk/gtk.h>

void on_window_destroy (GtkWidget *widget, gpointer user_data)
{
    gtk_main_quit ();
     /* quit main loop when windows closes */ 
}


int main (int argc, char *argv[])
{
    GtkWidget   *window, *label;

    gtk_init (&argc,&argv);
     /* initialize GTK+ */


    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
     /* create the main window */

    label = gtk_label_new ("Hello world !");
     /* create a label with sample text */

    gtk_container_add (GTK_CONTAINER (window), label);
     /* define the label as window child*/

    gtk_widget_show_all (window);
     /* display window and children */


    g_signal_connect (window, "destroy", G_CALLBACK(on_window_destroy), NULL);
     /* connect the window closing event with the "on_window_destroy" function */

    gtk_main ();
     /* MAIN LOOP */

    return 0;
}
错误:

c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll):(.text+0x0): multiple definition of `_fmode'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-xtxtmode.o):(.bss+0x0): first defined here
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libkernel32.a(KERNEL32.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): string not null terminated in ILF object file.
c:/program files (x86)/gcc/bin/../lib/gcc/x86_64-w64-mingw32/5.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/msys64/opt/x86_64-w64-mingw32/lib/libmsvcrt.a(msvcrt.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x116): undefined reference to `__getmainargs'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x1dd): undefined reference to `__imp_GetStartupInfoA'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x22d): undefined reference to `__imp_Sleep'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x2ad): undefined reference to `_initterm'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x2da): undefined reference to `_initterm'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.text+0x349): undefined reference to `__imp_SetUnhandledExceptionFilter'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.rdata$.refptr.__imp___initenv[.refptr.__imp___initenv]+0x0): undefined reference to `__imp___initenv'
C:/Program Files (x86)/gcc/x86_64-w64-mingw32/lib/../lib/crt2.o:crtexe.c:(.rdata$.refptr.__imp__acmdln[.refptr.__imp__acmdln]+0x0): undefined reference to `__imp__acmdln'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-crt_handler.o): In function `__mingw_init_ehandler':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/crt_handler.c:87: undefined reference to `__imp_RtlAddFunctionTable'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-merr.o): In function `_matherr':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/merr.c:72: undefined reference to `fprintf'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-gs_support.o): In function `__security_init_cookie':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:62: undefined reference to `__imp_GetSystemTimeAsFileTime'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:70: undefined reference to `__imp_GetCurrentProcessId'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:74: undefined reference to `__imp_QueryPerformanceCounter'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-gs_support.o): In function `__report_gsfailure':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:111: undefined reference to `__imp_RtlCaptureContext'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:147: undefined reference to `__imp_SetUnhandledExceptionFilter'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:149: undefined reference to `__imp_GetCurrentProcess'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/gs_support.c:150: undefined reference to `abort'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o): In function `__report_error':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c:156: undefined reference to `abort'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-atonexit.o): In function `mingw_onexit':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/atonexit.c:43: undefined reference to `_lock'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/atonexit.c:47: undefined reference to `__dllonexit'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/atonexit.c:51: undefined reference to `_unlock'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/atonexit.c:42: undefined reference to `__imp__onexit'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-pesect.o): In function `_FindPESectionByName':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/pesect.c:88: undefined reference to `strncmp'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-tlsthrd.o): In function `__mingw_TLScallback':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/tlsthrd.c:129: undefined reference to `__imp_InitializeCriticalSection'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-tlsthrd.o): In function `__mingwthr_run_key_dtors':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/tlsthrd.c:108: undefined reference to `__imp_TlsGetValue'
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/tlsthrd.c:108: undefined reference to `__imp_TlsGetValue'
C:/msys64/opt/x86_64-w64-mingw32/lib/libmingw32.a(lib64_libmingw32_a-tlsthrd.o): In function `__mingw_TLScallback':
/msys_scripts/mingw-w64-cross-crt-git/src/mingw-w64/mingw-w64-crt/crt/tlsthrd.c:145: undefined reference to `__imp_DeleteCriticalSection'
collect2.exe: error: ld returned 1 exit status
我该如何解决这个问题


另外,在安装MinGW64之前,我已经安装了GCC。也许新旧版本之间存在一些冲突?

MSYS2没有在“程序文件”中安装任何内容,因此在错误消息中看到“c:/Program Files(x86)/gcc”会告诉我您的系统配置错误。我建议从PATH环境变量中删除以前安装的GCC,这样就不会在MSYS2中意外运行它。然后使用“开始”菜单中名为“MinGW-w64 Win64 shell”的快捷方式启动MSYS2 shell(或运行mingw64_shell.bat)。然后运行此命令以安装64位MinGW toolchain软件包:

pacman -S mingw-w64-x86_64-toolchain
完成此操作后,键入
哪个gcc
,并验证它是否为
/mingw64/bin/gcc
。一旦使用了正确的工具链,就可以解决GTK的问题


另外,我的MSYS2安装中的
/opt
中没有任何内容。它只是一个空目录。如果您在
/opt
中有文件,那么我怀疑这是不正确的,您不应该尝试使用它们。要想弄清楚为什么在
/opt
中有文件,可以运行
pacman-Qo/path/To/some/file
,查看
/opt
中的文件是否真的属于某个包。

MSYS2没有安装任何“程序文件”,因此请参阅“c:/Program files(x86)/gcc”在您的错误消息中告诉我您的系统配置错误。我建议从PATH环境变量中删除以前安装的GCC,这样就不会在MSYS2中意外运行它。然后使用“开始”菜单中名为“MinGW-w64 Win64 shell”的快捷方式启动MSYS2 shell(或运行mingw64_shell.bat)。然后运行此命令以安装64位MinGW toolchain软件包:

pacman -S mingw-w64-x86_64-toolchain
完成此操作后,键入
哪个gcc
,并验证它是否为
/mingw64/bin/gcc
。一旦使用了正确的工具链,就可以解决GTK的问题


另外,我的MSYS2安装中的
/opt
中没有任何内容。它只是一个空目录。如果您在
/opt
中有文件,那么我怀疑这是不正确的,您不应该尝试使用它们。要想弄清楚为什么在
/opt
中有文件,可以运行
pacman-Qo/path/To/some/file
,查看
/opt
中的文件是否真的属于某个包。

你就是那个人!我删除了我以前的gcc,不得不删除它的路径和BAM,它编译。现在我可以专注于编码而不是安装软件了。在我的MSYS2版本上(在程序和功能上写着
20161025
),我没有
mingw64_shell.bat
,但我有
C:\msys64\MSYS2_shell.cmd-mingw32
C:\msys64\usr\bin\mintty.exe C:\msys64\MSYS2_shell.cmd-mingw32
。对于64位版本的MinGW,您可以将以前的命令
-mingw32
替换为
-mingw64
。您就是那个人!我删除了我以前的gcc,不得不删除它的路径和BAM,它编译。现在我可以专注于编码而不是安装软件了。在我的MSYS2版本上(在程序和功能上写着
20161025
),我没有
mingw64_shell.bat
,但我有
C:\msys64\MSYS2_shell.cmd-mingw32
C:\msys64\usr\bin\mintty.exe C:\msys64\MSYS2_shell.cmd-mingw32
。对于64位版本的MinGW,您可以将以前的命令中的
-mingw32
替换为
-mingw64