我在c:\ cygwins目录的Windows上安装了来自http://win-builds.org的win-builds。 现在编译任何基本或gtk代码时,gcc会抛出无法找到
的错误 gtk_test.c:1:21: fatal error: gtk/gtk.h: No such file or directory
#include <gtk/gtk.h>
^
或
button_example_01.c:1:24: fatal error: Elementary.h: No such file or directory
#include <Elementary.h>
^
我尝试按照http://win-builds.org/1.5.0/msys-cygwin.html#_change_toolchain_on_the_fly中提到的win-builds文档'source / opt / windows_64 / bin / win-builds-switch'的建议切换工具链
如果Elementary.h
错误,我可以找到此文件
$ find /opt/windows_32/ -name 'Elementary.h'
/opt/windows_32/include/elementary-1/Elementary.h
当我通过提供从pkg-config返回的cflags和libs值编译程序时,此文件路径就是
/opt/windows_32/bin/i686-w64-mingw32-gcc -o button_example_01 button_example_01.c -I/opt/windows_32/include/elementary-1/ -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-win32-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ethumb-client-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ethumb-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/edje-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/embryo-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-imf-evas-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-evas-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-input-evas-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/emotion-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/evas-1 -I/opt/windows_32/include/libpng14 -I/opt/windows_32/include/harfbuzz -I/opt/windows_32/include/fribidi -I/opt/windows_32/include -I/opt/windows_32/include/freetype2 -I/opt/windows_32/include -I/opt/windows_32/include/freetype2 -I/opt/windows_32/include -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-imf-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-input-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/efreet-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/efreet-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/efreet-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/eldbus-1 -I/opt/windows_32/include/dbus-1.0 -I/opt/windows_32/lib/dbus-1.0/include -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-file-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-con-1 -I/opt/windows_32/include -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/eio-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/eet-1 -I/opt/windows_32/include -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/ecore-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/eo-1 -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/eina-1 -I/opt/windows_32/include/eina-1/eina -I/opt/windows_32/include/efl-1 -I/opt/windows_32/include/evil-1 -L/opt/windows_32/lib -lelementary -lm -leina -lpthread -leet -levas -lecore -lecore_evas -lecore_file -lecore_input -ledje -leo -lethumb_client -lemotion -lecore_imf -lecore_con -leldbus -lefreet -lefreet_mime -lefreet_trash -leio -levil -lecore_win32 -lole32 -lgdi32 -lethumb_client -lethumb -ledje -lm -lembryo -lm -lecore_imf_evas -lecore_evas -lecore_input_evas -lemotion -levas -ljpeg -lm -lpng14 -lz -lharfbuzz -lfribidi -lfontconfig -lexpat -lfreetype -lexpat -lfreetype -lpng14 -llua -lm -lecore_imf -lecore_input -lefreet -lefreet_mime -lefreet_trash -leldbus -ldbus-1 -lpthread -lws2_32 -lecore_file -lecore_con -lm -lcares -lws2_32 -leio -lm -leet -lm -ljpeg -lz -lecore -lm -lintl -L/opt/windows_32/lib -leo -leina -lpthread -lm -liconv -levil
button_example_01.c:1:24: fatal error: Elementary.h: No such file or directory
#include "Elementary.h"
^
compilation terminated.
我猜是gcc没有解释cygwin / opt / ...路径。 如果有人能帮我解决这个问题,我将不胜感激?
答案 0 :(得分:0)
查看GTK的这个链接,了解如何编译包含GTK库的程序:gnome-link。特别注意使用&#34; pkg-config&#34;。
答案 1 :(得分:0)
致命错误:'找不到'Elementary.h'文件似乎是一个常见问题。感谢Jeff对此的回答:http://forums.bodhilinux.com/index.php?/topic/12061-answered-help-compiling-elementary-code-examples/
这个答案也帮助我让小学在BodhiLinux上编译。当我在FreeBSD上尝试它时,我也遇到了同样的错误,尽管我在系统中安装了一个Elementary.h。 我想在freebsd的页面上检查efl的依赖关系:
https://www.freebsd.org/cgi/ports.cgi?query=enlightenment&stype=all
我浏览了efl-1.18.4的每个依赖项,发现我必须添加: autoconf,automake,bullet,gmake,gmp,libdvdcss,libtool,pkgconf和png。 这为cc和clang做了以下工作:
cc getstarted.c -o GetStarted `pkgconf elementary --cflags --libs`
如果遇到问题,请检查依赖项。就我而言,我认为pkgconf完成了这项工作。