0

我正在尝试构建一些我在 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 拒绝构建它。

4

1 回答 1

1

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

target_link_libraries(... ${SOLID_LIBS} ...)
于 2012-03-03T14:18:25.350 回答