0

Windows 10/Surface Pro 2 に MinGW64 (MSYS2) をインストールしました。次に、GTK3 と他の多くのパッケージを pacman でインストールしました。すべての 64 ビット バージョンです。gtk3-demo を実行することもでき、ウィンドウがポップアップします。しかし、単純な 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;
}

これはすべてからコンパイルされており、pthreadを機能させるためpkg-config --cflags --libs gtk+-3.0に追加する必要があり ました。-L /opt/x86_64-w64-mingw32/lib

コンパイル:

gcc test.c -mms-bitfields -pthread -mms-bitfields -I/mingw64/include/gtk-3.0 -I/mingw64/include/cairo -I/mingw64/include -I/mingw64/include/pango-1.0 -I/mingw64/include/atk-1.0 -I/mingw64/include/cairo -I/mingw64/include/pixman-1 -I/mingw64/include -I/mingw64/include/freetype2 -I/mingw64/include/libpng16 -I/mingw64/include/harfbuzz -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -I/mingw64/include -I/mingw64/include/freetype2 -I/mingw64/include -I/mingw64/include/harfbuzz -I/mingw64/include/libpng16 -I/mingw64/include/gdk-pixbuf-2.0 -I/mingw64/include/libpng16 -I/mingw64/include/glib-2.0 -I/mingw64/lib/glib-2.0/include -L/mingw64/lib -LC:/building/msys64/mingw64/lib -L/mingw64/lib -LC:/building/msys64/mingw64/lib/../lib -L/mingw64/lib -lgtk-3 -lgdk-3 -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm -ldwmapi -lz -lepoxy -lpangocairo-1.0 -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lusp10 -lpango-1.0 -lm -latk-1.0 -lcairo-gobject -lcairo -lz -lpixman-1 -lfontconfig -lexpat -lfreetype -liconv -lexpat -lfreetype -lz -lbz2 -lharfbuzz -lpng16 -lz -lgdk_pixbuf-2.0 -lpng16 -lz -lgio-2.0 -lz -lgmodule-2.0 -pthread -lgobject-2.0 -lffi -lglib-2.0 -lintl -pthread -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -L /opt/x86_64-w64-mingw32/lib

エラー:

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

これを修正するにはどうすればよいですか?

PS、MinGW64をインストールする前に、すでにGCCをインストールしていました。おそらく、古いものと新しいものの間にいくつかの競合がありますか?

4

1 に答える 1

3

MSYS2 は「Program Files」に何もインストールしないため、エラー メッセージに「c:/program files (x86)/gcc」が表示されると、システムが正しく構成されていないことがわかります。以前にインストールした GCC を PATH 環境変数から削除して、MSYS2 で誤って実行しないようにすることをお勧めします。次に、スタート メニューで「MinGW-w64 Win64 Shell」という名前のショートカットを使用して (または mingw64_shell.bat を実行して)、MSYS2 シェルを開始します。次に、次のコマンドを実行して、64 ビットの MinGW ツールチェーン パッケージをインストールします。

pacman -S mingw-w64-x86_64-toolchain

それを行った後、それが であることを入力which gccして確認します/mingw64/bin/gcc。適切なツールチェーンを使用すると、GTK に関する問題が解決する可能性があります。

また、/opt私の MSYS2 インストールには何もありません。それはただの空のディレクトリです。ファイルがある場合、/optそれは間違っているのではないかと思います。それらを使用しないでください。にファイルがある理由を理解するために/opt、 を実行pacman -Qo /path/to/some/fileして、それらのファイル/optが実際にパッケージによって所有されているかどうかを確認できます。

于 2016-02-26T18:49:13.817 に答える