[Qt-creator] qt-creator indexing
Lorenzo Bettini
bettini at dsi.unifi.it
Fri Jul 31 19:45:34 CEST 2009
Daniel Teske wrote:
> On Friday 31 July 2009 15:34:10 ext Lorenzo Bettini wrote:
>> Daniel Teske wrote:
>>> On Friday 31 July 2009 12:11:50 ext Lorenzo Bettini wrote:
>>>> Daniel Teske wrote:
>>>>> On Thursday 30 July 2009 12:04:32 ext Lorenzo Bettini wrote:
>>>>>> Daniel Teske wrote:
>>>>>>>> mh.... but I don't want to spoil the .pro file with something
>>>>>>>> hardcoded... the headers and libs are found by pkg-config... isn't
>>>>>>>> there a way to solve the problem?
>>>>>>> Could you attach your .pro file and the output of
>>>>>>> pkg-config --cflags-only-I $PKGCONFIG ?
>>>>>> I don't know what you mean by $PKGCONFIG, however, this is the output
>>>>>> for the library I use (note that I need to use PKG_CONFIG_PATH
>>>>>> environment variable, since the libraries I use are in my home):
>>>>>>
>>>>>> PKG_CONFIG_PATH=~/usr/local/lib/pkgconfig/ pkg-config --cflags-only-I
>>>>>> source-highlight-qt4
>>>>> So does it work if you start creator from an environment where
>>>>> PKG_CONFIG_PATH is set?
>>>> No:
>>>>
>>>> PKG_CONFIG_PATH is already part of the Build environment variables in
>>>> the project settings, with the correct path, otherwise qmake would fail.
>>>> The problem is that the indexing of qt-creator cannot find the headers
>>>> anyway... what does the indexing use for searching for header file
>>>> directories?
>>> If you don't want to try what I suggested, then I can't help you.
>> Sorry Daniel
>>
>> my answer was not clear: I also started qt-creator from an environment
>> where PKG_CONFIG_PATH was set, but it still didn't work. You meant
>> something like
>>
>> export PKG_CONFIG_PATH=...
>> ./qt-creator.bin
>>
>> right?
>>
>> it didn't work.
>
> Hmm, that's strange. The lines which should add the include path from
> PKGCONFIG are in qt4project.cpp, lines 530-542. You can try adding a few
> qDebug() there. I can look into testing that again on Monday.
>
> daniel
OK, so I modified that part as follows:
{ // Pkg Config support
qDebug() << "pkgConfig support";
QStringList pkgConfig = pro->variableValue(PkgConfigVar);
if (!pkgConfig.isEmpty()) {
qDebug() << "running pkgConfig support";
pkgConfig.prepend("--cflags-only-I");
qDebug() << "pkgConfig: ";
qDebug() << pkgConfig;
QProcess process;
process.start("pkg-config", pkgConfig);
process.waitForFinished();
QString result = process.readAllStandardOutput();
qDebug() << "pkgConfig RESULTS:";
qDebug() << result;
foreach(const QString &part, result.trimmed().split('
', QString::SkipEmptyParts)) {
info.includes.append(part.mid(2)); // Chop off "-I"
qDebug() << "appending: " << part.mid(2);
}
}
}
and when I run qt-creator (with PKG_CONFIG_PATH variable set to
/home/bettini/usr/local/lib/pkgconfig), I get this output in the console
which looks good:
pkgConfig support
running pkgConfig support
pkgConfig:
("--cflags-only-I", "source-highlight-qt4")
pkgConfig RESULTS:
"-I/home/bettini/usr/local/include -I/usr/share/qt4/mkspecs/linux-g++
-I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
-I/usr/include/qt4 -I/home/bettini/usr/local/lib/include
"
appending: "/home/bettini/usr/local/include"
appending: "/usr/share/qt4/mkspecs/linux-g++"
appending: "."
appending: "/usr/include/qt4/QtCore"
appending: "/usr/include/qt4/QtGui"
appending: "/usr/include/qt4"
appending: "/home/bettini/usr/local/lib/include"
and the directory /home/bettini/usr/local/lib/include contains the
header directories:
srchilite
srchiliteqt
still, in my project in qt-creator these includes:
#include <srchilite/versions.h>
#include <srchilite/sourcehighlight.h>
#include <srchilite/parserexception.h>
#include <srchilite/lineranges.h>
#include <srchiliteqt/ColorDialog.h>
#include <srchiliteqt/Qt4SourceHighlightStyleGenerator.h>
are not recognized (they are underlined in yellow)
hope this helps
thanks
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
More information about the Qt-creator-old
mailing list