我已经在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;
}
使用pkg-config --cflags --libs gtk+-3.0
编译了所有这些内容,我还必须添加-L /opt/x86_64-w64-mingw32/lib
才能让pthread工作。
编译:
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。也许旧旧之间存在一些冲突?
答案 0 :(得分:3)
MSYS2不会向&#34; Program Files&#34;安装任何内容,因此请查看&#34; c:/ program files(x86)/ gcc&#34;在您的错误消息中告诉我您的系统配置错误。我建议从PATH环境变量中删除以前安装的GCC,这样您就不会在MSYS2中意外运行它。然后使用名为&#34; MinGW-w64 Win64 Shell&#34;的快捷方式启动MSYS2 shell。在开始菜单中(或通过运行mingw64_shell.bat)。然后运行此命令以安装64位MinGW工具链包:
pacman -S mingw-w64-x86_64-toolchain
执行此操作后,键入which gcc
并验证它是/mingw64/bin/gcc
。一旦您使用正确的工具链,这可能会解决您的GTK问题。
此外,我的MSYS2安装中的/opt
中没有任何内容。它只是一个空目录。如果您在/opt
中有文件,那么我怀疑这是不正确的,您不应该尝试使用它们。要找出/opt
中有文件的原因,您可以运行pacman -Qo /path/to/some/file
以查看/opt
中的这些文件是否实际归包所有。