QtCreator和pkg-config

时间:2014-03-05 17:38:52

标签: c++ qt-creator

我将一个makefile项目导入到Qt创建器中,以实现更高效的开发。当我在终端使用make时:

g++  Size3.o SteerableTests.o MyLib.o Tensor.o Cube.o Steerable.o -lUnitTest++ `pkg-config --libs opencv` -o steerable

它成功编译。但是当使用QtCreator的构建选项时,它一直说pkg-config找不到opencv。如何设置QtCreator的环境路径?

11:35:21: Starting: "/usr/bin/make" all
g++  Size3.o SteerableTests.o MyLib.o Tensor.o Cube.o Steerable.o -lUnitTest++ `pkg-config --libs opencv` -o steerable
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found

1 个答案:

答案 0 :(得分:0)

我的猜测是环境变量PKG_CONFIG_PATH是在shell中设置的,而不是在 QtCreator 的环境中设置的。

我能想到的解决这个问题的最简单方法是在Makefile明确设置它,例如

export PKG_CONFIG_PATH=/the/path

要查找/the/path,请在shell中尝试echo $PKG_CONFIG_PATH,或使用opencv.pc(最好)或locate查找find