我正在尝试在kubuntu lucid上使用Qt Creator中的Clucene-0.9.21b和libcue-1.3.0。 此代码是可以编译的:

Project.Pro

SOURCES += main.cpp
LIBS += -lcue
INCLUDEPATH += /usr/include/libcue-1.3/libcue

main.cpp

extern "C" {
 #include <libcue.h>
}
int main(int argc, char *argv[]) {
 return 0;
}

这也是如此:

Project.Pro

SOURCES += main.cpp
LIBS += -clucene

main.cpp

#include <CLucene.h>
int main(int argc, char *argv[]) {
 return 0;
}

但不是这个:

Project.Pro

SOURCES += main.cpp
LIBS += -lcue \
 -clucene
INCLUDEPATH += /usr/include/libcue-1.3/libcue

main.cpp

extern "C" {
 #include <libcue.h>
}
#include <CLucene.h>
int main(int argc, char *argv[]) {
 return 0;
}

后者产生以下错误:

Running build steps for project project...
Configuration unchanged, skipping QMake step.
Starting: /usr/bin/make -w 
make: Entering directory `/home/user/project/project'
/usr/bin/qmake-qt4 -spec /usr/share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile project.pro
make: Leaving directory `/home/user/project/project'
make: Entering directory `/home/user/project/project'
g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I/usr/include/libcue-1.3/libcue -I. -o main.o main.cpp
In file included from /usr/include/sys/stat.h:107,
from /usr/include/CLucene/StdHeader.h:76,
from /usr/include/CLucene.h:11,
from main.cpp:5:
/usr/include/bits/stat.h:88: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:89: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:90: error: field ‘st_ctim’ has incomplete type
/usr/include/bits/stat.h:149: error: field ‘st_atim’ has incomplete type
/usr/include/bits/stat.h:150: error: field ‘st_mtim’ has incomplete type
/usr/include/bits/stat.h:151: error: field ‘st_ctim’ has incomplete type
main.cpp:6: warning: unused parameter ‘argc’
main.cpp:6: warning: unused parameter ‘argv’
make: *** [main.o] Error 1
make: Leaving directory `/home/user/project/project'
Exited with code 2.
Error while building project project
When executing build step 'Make'

为什么那是以及如何使它起作用?

有帮助吗?

解决方案

好的,这次我有机会实际尝试。问题似乎是libcue在其包含文件夹中有一个名为time.h的文件。因此,如果您使用-i/usr/include/libcue -1.4/libcue编译,则最终会得到libcue的时间。H而不是libc。

这对我有用:

extern "C" {
 #include <libcue/libcue.h>
}
#include <CLucene.h>

int main(int argc, char *argv[]) {
 return 0;
}

并显然用-i/usr/include/libcue -1.4/而不是-i/usr/include/libcue -1.4/libcue

其他提示

如果您交换提示和Clucene包含在周围的情况下会发生什么?包括订单可能是一个问题,我怀疑混合C和C ++可能会使订单更重要

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top