I am trying to turn ovpn3's ovpncli example into a class that derives from QObject. I'm unable to turn the source file into a separate interface (.h) and implementation (.cpp) file. To make the MOC happy, I've put #include "openvpn.moc"
at the end of openvpn.cpp (the source file). I am getting this error however: :-1: error: No rule to make target 'openvpn.moc', needed by 'openvpnmanager.o'. Stop.
I've cleaned the build directory, re-ran qmake, and rebuilt it 1000 times. Despite this, it still refuses to work. What am I doing wrong?
myproject.pro:
QT += core widgets network
CONFIG += c++11
UI_SOURCES_DIR = src/gui
UI_HEADERS_DIR = include
. . .
SOURCES += \
src/main.cpp \
src/gui/loginwindow.cpp \
src/api/api.cpp \
src/openvpn/openvpn.cpp \
src/alert.cpp \
src/gui/vpn.cpp \
src/api/account.cpp \
src/crypto.cpp \
src/killswitch.cpp \
src/vpnstatus.cpp \
src/gui/logdialog.cpp \
src/logitem.cpp \
src/authenticationworker.cpp \
src/api/error.cpp \
src/openvpn/openvpnmanager.cpp \
src/api/server.cpp \
src/api/authenticationresponse.cpp
HEADERS += \
include/loginwindow.h \
include/api.h \
include/alert.h \
include/vpn.h \
include/account.h \
include/crypto.h \
include/killswitch.h \
include/configtype.h \
include/vpnstatus.h \
include/connectionstatus.h \
include/loglevel.h \
include/logdialog.h \
include/logitem.h \
include/authenticationworker.h \
include/error.h \
include/openvpnmanager.h \
include/server.h \
include/authenticationresponse.h \
FORMS += \
src/gui/loginwindow.ui \
src/gui/vpn.ui \
src/gui/logdialog.ui
RESOURCES += \
src/resources.qrc
DISTFILES +=
openvpn.cpp:
class Client : public QObject, public ClientAPI::OpenVPNClient {
Q_OBJECT
public:
. . .