Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

#if/#endif directives change behaviour of vtable

$
0
0
Can someone explain that to me: This code here produces an “undefined reference to vtable” error: #ifdef __ANDROID__ #ifndef ANDROIDLOGIN_HPP #define ANDROIDLOGIN_HPP #include <QObject> class LoginSystem : public QObject {     Q_OBJECT public:     explicit LoginSystem(QObject *parent = 0); signals:     void accessTokenRceived(QString); public slots:     void login(); }; #endif // ANDROIDLOGIN_HPP #endif While this one works fine: #ifndef ANDROIDLOGIN_HPP #define ANDROIDLOGIN_HPP #include <QObject> class LoginSystem : public QObject {     Q_OBJECT public:     explicit LoginSystem(QObject *parent = 0); signals:     void accessTokenRceived(QString); public slots:     void login(); }; #endif // ANDROIDLOGIN_HPP The strange part is, when the first one is compiled for PC everything works fine. When its compiled for android ld prints out: “../tiz/src/facebook/login/androidLogin.cpp:7: error: undefined reference to ‘vtable for LoginSystem‘” What am I doing wrong? Isn’t it the sense of the #if/#endif directives to only cut out code? So in case of compiling for android I expected them to behave like they wouldn’t be there. Also here is the cpp: #ifdef __ANDROID__ #include "androidLogin.hpp" LoginSystem::LoginSystem(QObject *parent) :     QObject(parent) { } void LoginSystem::login() { } #endif

Viewing all articles
Browse latest Browse all 13965

Trending Articles