[SOLVED] Error to declare signal

  • Hello All!

    I am trying to declare a signal as the code below shows:
    #ifndef BANCODADOS_H
    #define BANCODADOS_H

    #include <QObject>

    class bancoDados : public QObject

    explicit bancoDados(QObject *parent = 0);

    void conectar();

    public slots:

    #include "bancodados.h"

    #include <QSqlDatabase>

    bancoDados::bancoDados(QObject *parent) :

    void bancoDados::conectar()
    bool retorno = true;

    emit retorno;


    Well, when I run this code it show the error:
    @:-1: error: 1 duplicate symbol for architecture x86_64@

    But, if I change "void conectar();" from signals to public, it runs, but I need to it stays as a signal

    Can anyone help me?

    Thanks a lot.

  • Lifetime Qt Champion


    signals don't have an implementation and you can't emit a variable.

    See the "Signals And Slots":http://qt-project.org/doc/qt-5/signalsandslots.html documention for more information

  • Thaks a lot

Log in to reply