[英]Change PKG_CONFIG_PATH of pkg-config in MinGW
I want to change the directory where pkg-config
looks for .pr
files. 我想更改
pkg-config
查找.pr
文件的目录。 I'm using pkg-config
under MinGW on Windows. 我在Windows的MinGW下使用
pkg-config
。 I found that this can be done by changing the PKG_CONFIG_PATH environment variable using export PKG_CONFIG_PATH=[path]
. 我发现可以通过使用
export PKG_CONFIG_PATH=[path]
更改PKG_CONFIG_PATH环境变量来完成此操作。 The .pr
files I want pkg-config
to find are not installed in the MinGW directory, but somewhere in the "normal" windows file system (C:\\Program Files (x86)\\Gtk+\\lib\\pkgconfig). 我希望
pkg-config
查找的.pr
文件未安装在MinGW目录中,而是安装在“普通” Windows文件系统中的某个位置(C:\\ Program Files(x86)\\ Gtk + \\ lib \\ pkgconfig)。
Now to my problem: If I run export PKG_CONFIG_PATH="/c/Program Files (x86)/Gtk+/lib/pkg-config/
and then run pkg-config --cflags gtk+-win32-2.0
I get the following output. 现在是我的问题:如果我运行
export PKG_CONFIG_PATH="/c/Program Files (x86)/Gtk+/lib/pkg-config/
,然后运行pkg-config --cflags gtk+-win32-2.0
得到以下输出。
$ pkg-config --cflags gtk+-win32-2.0 --debug Option --debug seen Error printing enabled by default due to use of --version, --libs, --cflags, --libs-only-l, --libs-only-L, --libs-only-other, --cflags-only-I, --cflag s-only-other or --list. Value of --silence-errors: 0 Error printing enabled Adding virtual 'pkg-config' package to list of known packages Cannot open directory 'c' in package search path: No such file or directory Cannot open directory '/Program Files (x86)/Gtk+/lib/pkgconfig/' in package search path: No such file or directory Scanning directory '/usr/lib/pkgconfig' Ignoring file '.' in search directory; not a .pc file Ignoring file '..' in search directory; not a .pc file
etc. 等等
So how must I specify the path of the .pr
files so pkg-config can find it? 那么,如何指定
.pr
文件的路径,以便pkg-config可以找到它? This is not an issue if I install the .pr
files in the MinGW directory, they are found without changing the environment variable. 如果我将
.pr
文件安装在MinGW目录中,则这不是问题,可以在不更改环境变量的情况下找到它们。
No, you should use $(GTK_COMPILE) in your main.o Makefile target instead of $(GTK_LINK). 不,您应该在main.o Makefile目标中使用$(GTK_COMPILE)而不是$(GTK_LINK)。 $(GTK_COMPILE) calls pkg-config --cflags which will return the CFLAGS you need to compile (the location of the header files).
$(GTK_COMPILE)调用pkg-config --cflags,它将返回您需要编译的CFLAGS(头文件的位置)。 The LIBS you need for linking, not compiling
链接而不是编译所需的LIBS
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.