KD App没有构建,未定义对Solid libs的引用

时间:2012-02-20 22:33:01

标签: c++ qt kde undefined-reference kdevelop

我正在尝试构建一些我在KDevelop中编写的KDE软件,但是我遇到了这些错误:

CMakeFiles/kquickformat.dir/deviceinfo.o: In function `QList<Solid::Device>::node_destruct(QList<Solid::Device>::Node*, QList<Solid::Device>::Node*)':
/usr/include/QtCore/qlist.h:418: undefined reference to `Solid::Device::~Device()'
CMakeFiles/kquickformat.dir/deviceinfo.o: In function `DeviceInfo':
/home/kemra102/projects/KDE/kquickformat/src/deviceinfo.cpp:5: undefined reference to `Solid::DeviceNotifier::instance()'
/home/kemra102/projects/KDE/kquickformat/src/deviceinfo.cpp:7: undefined reference to `Solid::Device::listFromType(Solid::DeviceInterface::Type const&, QString const&)'
CMakeFiles/kquickformat.dir/deviceinfo.o: In function `DeviceNotifier':
/usr/include/KDE/Solid/../../solid/devicenotifier.h:42: undefined reference to `vtable for Solid::DeviceNotifier'
CMakeFiles/kquickformat.dir/deviceinfo.o: In function `~DeviceNotifier':
/usr/include/KDE/Solid/../../solid/devicenotifier.h:42: undefined reference to `vtable for Solid::DeviceNotifier'

相关代码如下:

#include "deviceinfo.h"

DeviceInfo::DeviceInfo(Solid::DeviceNotifier *parent)
{
  Solid::DeviceNotifier *notifier = Solid::DeviceNotifier::instance();

  QList<Solid::Device> list =  Solid::Device::listFromType(Solid::DeviceInterface::StorageDrive, QString());
}

#ifndef DEVICEINFO_H
#define DEVICEINFO_H

#include <QList>
#include <QString>
#include <Solid/Device>
#include <Solid/DeviceNotifier>
#include <Solid/StorageDrive>

class DeviceInfo : public Solid::DeviceNotifier
{
  public:


  private:
    DeviceInfo(Solid::DeviceNotifier *parent=0);
    Solid::DeviceNotifier* notifier;
    QList<Solid::Device> list;
};

#endif

我肯定安装了库,可以在我的文件系统上看到它们,所以我无法理解为什么Kdevelop拒绝构建它。

1 个答案:

答案 0 :(得分:1)

您告诉CMake链接这些库吗?我相信你可以使用“$ {SOLID_LIBS}”var,如下所示:

target_link_libraries(... ${SOLID_LIBS} ...)