找不到可执行文件,请指定一个

could not find the executable please specify one

我正在尝试使用 qt 使用 C++ 创建一个 dll 文件。 在我的 mylib.cpp 中,我有:

#include "mylib.h"
MyLib::MyLib()
{
}

void MyLib::Test()
{
    qDebug()<<"Hello from DLL!";
}

mylib.h中:

#ifndef MYLIB_H
#define MYLIB_H

#include "mylib_global.h"
#include<QDebug>

class MYLIBSHARED_EXPORT MyLib
{

public:
    MyLib();
    void Test();
};

#endif // MYLIB_H

在我的 MyLib.pro:

#-------------------------------------------------
#
# Project created by QtCreator 2015-03-13T15:09:07
#
#-------------------------------------------------

QT       -= gui

TARGET = MyLib
TEMPLATE = lib

DEFINES += MYLIB_LIBRARY

SOURCES += mylib.cpp

HEADERS += mylib.h\
        mylib_global.h

unix {
    target.path = /usr/lib
    INSTALLS += target
}

如果我运行项目我收到这样的通知:

我的代码没有生成dll文件。

我该怎么办?我该如何解决这个问题?

你不能 运行 一个库,所以没有可执行文件,这个错误是完全可以预料的。 运行没什么。 dll 肯定会在构建目录中生成。只要去那里,你就会找到它。