2014-03-05 130 views
0

我將一個makefile項目導入到Qt創建器中以實現更高效的開發。當我在終端使用make時:QtCreator和pkg-config

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

它編譯成功。但是當使用QtCreator的build選項時,它一直說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 

回答

0

我的猜測是,環境變量PKG_CONFIG_PATH在你的shell設置,而不是在QtCreator的環境。

我能想到的最簡單的方法是在Makefile中明確地設置它,例如,

export PKG_CONFIG_PATH=/the/path 

爲了找到/the/path,嘗試echo $PKG_CONFIG_PATH在殼或使用locate(優選地)或find找到opencv.pc