configure: error: cannot find QtCore header

Mojca Miklavec mojca at
Thu Jun 11 09:19:11 PDT 2015

On Thu, Jun 11, 2015 at 4:44 PM, Hinckley Dan wrote:
> On 11 Jun, 2015, at 8:08, Rainer Müller wrote:
>> On 2015-06-11 13:09, Hinckley Dan wrote:
>>> I have qt5-mac installed and am compiling a program which looks for qtccore. The error I get is:
>>> checking QtCore usability... no
>>> checking QtCore presence... no
>>> checking for QtCore... no
>>> configure: error: cannot find QtCore header; try setting CPPFLAGS.
>> You should look into config.log to get the details of this failing test.
>> Perhaps it is also trying to link a simple program which requires setting LDFLAGS as well.
>> Have you made sure it is actually looking for the right version of Qt? Often, Qt 5.x is referenced by Qt5Core and Qt 4.x is QtCore.
>> # libqt 4.7 or compatible newer version is required.
>> AC_CHECK_HEADER([QtCore], [],
>>                 [AC_MSG_ERROR([cannot find QtCore header; try setting CPPFLAGS.])])
>> AC_CHECK_HEADER([QtGui], [],
>>                 [AC_MSG_ERROR([cannot find QtGui header; try setting CPPFLAGS.])])
>> AC_CHECK_HEADER([Qt3Support], [],
>>                 [AC_MSG_ERROR([cannot find Qt3Support header; try setting CPPFLAGS.])])
> I have qt-mac4 installed (and 5, but deactivated) but don’t know which path to put into the CPPFLAGS.

This is contradicting your previous claim that you have qt5-mac installed.

If you have qt5-mac deactivated, then building against Qt5 won't work,
no matter what combination of
flags you try to set.

But the code above seems to be looking after Qt 4, not Qt 5.

You could either use frameworks:
(with -F/opt/local/Library/Frameworks -framework QtCore)

or check the flags with

> pkg-config --libs QtCore
-L/opt/local/lib -lQtCore
> pkg-config --cflags QtCore
-DQT_SHARED -I/opt/local/include -I/opt/local/include/QtCore

These are the flags you need to get QtCore working, but you will
likely have to add others.


More information about the macports-users mailing list