2

I am fairly new to the Qt environment and I am running into an error when I try to build. I am also new to StackOverflow so pardon me if I miss format. When I run qmake from the command line it finds the opencv package and generates a Makefile, however when I run it from Qt Creator, it fails to find OpenCV.

Here is my .pro file

#-------------------------------------------------
#
# Project created by QtCreator 2013-03-24T21:23:01
#
#-------------------------------------------------

QT       += core
QT       -= gui
TARGET = cvtest
CONFIG   += console
CONFIG   -= app_bundle
CONFIG+=link_pkgconfig
PKGCONFIG+=opencv
TEMPLATE = app
SOURCES += main.cpp

I think it has to do with fully qualifying the path to qmake. If I run

qmake /Users/matt/untitled1/untitled1.pro -r -spec macx-g++ CONFIG+=x86_64

on the command line it works fine, however if I fully qualify the path to qmake in the manner that Qt Creator does it;

/Users/matt/Qt5.0.0/5.0.0/clang_64/bin/qmake /Users/matt/untitled1/untitled1.pro

I get the following error:

Project ERROR: Package opencv not found

Any ideas on how to make this work in Qt Creator without going to the command line?

aaronsnoswell
  • 6,051
  • 5
  • 47
  • 69
user2209545
  • 29
  • 1
  • 2
  • Use `which qmake` to check if you're actually running `/Users/matt/Qt5.0.0/5.0.0/clang_64/bin/qmake`. My bet is that you have qt 4.8 installed from macports and are inadvertently using that from Qt Creator. – Kuba hasn't forgotten Monica Sep 10 '13 at 12:16

1 Answers1

2

Try adding this to your .pro file:

QT_CONFIG -= no-pkg-config

I believe Qt for the Mac is built with the --no-pkg-config configure option.

Patrick
  • 2,243
  • 2
  • 23
  • 32
  • Full solution [here](http://stackoverflow.com/questions/16972066/using-pkg-config-with-qt-creator-qmake-on-mac-osx). – vmarquet Jul 18 '15 at 13:34