我尝试使用MinGW为Fedora x64 Eclipse上的Windows x86构建一个非常简单的应用程序。 应用程序编译好,但是,它不能链接。我的链接命令如下:无法在Fedora Eclipse上构建GTK + Windows应用程序
i686-w64-mingw32-g++ `mingw32-pkg-config --libs gtk+-2.0` -o "GtkTest" ./main.o
当我运行的mingw32-pkg配置--libs GTK + -2.0,输出如下:
-Wl,-luuid -L/usr/i686-w64-mingw32/sys-root/mingw/lib -lgtk-win32-2.0 -lgdk-win32-2.0 -limm32 -lshell32 -lole32 -latk-1.0 -lpangocairo-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangoft2-1.0 -lpangowin32-1.0 -lgdi32 -lfreetype -lfontconfig -lpango-1.0 -lm -lcairo -lgobject-2.0 -lglib-2.0 -lintl
在毫无疑问的文件夹和存在库文件。不过,我收到以下错误:
./main.o:main.cpp:(.text.startup+0x3e): undefined reference to `gtk_init_abi_check'
./main.o:main.cpp:(.text.startup+0x43): undefined reference to `gtk_builder_new'
./main.o:main.cpp:(.text.startup+0x3d): undefined reference to `gtk_builder_add_from_file'
./main.o:main.cpp:(.text.startup+0x46): undefined reference to `gtk_widget_get_type'
./main.o:main.cpp:(.text.startup+0x58): undefined reference to `gtk_builder_get_object'
./main.o:main.cpp:(.text.startup+0x64): undefined reference to `g_type_check_instance_cast'
./main.o:main.cpp:(.text.startup+0x76): undefined reference to `gtk_builder_connect_signals'
./main.o:main.cpp:(.text.startup+0x86): undefined reference to `g_type_check_instance_cast'
./main.o:main.cpp:(.text.startup+0x8e): undefined reference to `g_object_unref'
./main.o:main.cpp:(.text.startup+0x96): undefined reference to `gtk_widget_show'
./main.o:main.cpp:(.text.startup+0x9b): undefined reference to `gtk_main'
./main.o:main.cpp:(.text.startup+0xcb): undefined reference to `g_log'
./main.o:main.cpp:(.text.startup+0xd7): undefined reference to `g_free'
所以,它看起来像链接器未发现库可言,即使他们的存在,我引用它们的命令行。 可能是什么原因?
尝试在'pkg-config'之前移动目标文件,即'i686-w64-mingw32-g ++ ./main.o \'mingw32-pkg-config --libs gtk + -2.0 \'-o“GtkTest”',请参阅如果它有帮助 –