vendredi 14 juillet 2017

user-defined literals and whitespace and c++11 issues

I'm compiling very simple code and as output I receive error:

`../untitled6/main.cpp:17:1: error: unable to find string literal operator 'operator"" __FILE__'
     connect(&d_t, SIGNAL(timeout()), this, SLOT(doPlay()));`

The code is following:

#include <QObject>
#include <QTimer>

class Test : public QObject
{
    Q_OBJECT
public:
    explicit Test(QObject *parent = 0) : QObject(parent) {}

    void Play()
    {
         connect(&d_t, SIGNAL(timeout()), this, SLOT(doPlay()));
    }

public slots:
    void doPlay() {}

private:
    QTimer d_t;
};

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Test test;
    test.Play();
    return a.exec();
}

It is happened only if I include c++11 support in my project. Without this support the compilation is Okey. I have read about user-defined literals and whitespace for gcc ver. 4.7 when c++11 support is included. But my code doesn't include any FILE code.... I found that problem is related to SIGNAL and SLOT constructions. But I have no idea what is wrong here... P.S. For compilation I use sh4-linux-g++ (GCC) 4.8.

Aucun commentaire:

Enregistrer un commentaire