简体   繁体   中英

QtCreator and pkg-config

I imported a makefile project into Qt creator for more productive development. When I use make in the terminal:

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

It compiles successfully. But when using build option of QtCreator, it keeps saying that pkg-config can't find opencv. How to set the environment path for 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

My guess is that the environment variable PKG_CONFIG_PATH is set in your shell, but not in QtCreator 's environment.

The easiest way around this that I can think of is to set it explicitly in the Makefile , eg

export PKG_CONFIG_PATH=/the/path

To find /the/path , try echo $PKG_CONFIG_PATH in the shell or find opencv.pc using locate (preferably) or find .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM