[Solved] Does anyone know how to solve this error I get in c++



  • So, the errors that I get are:

    symbol(s) not found for architecture x86_64

    linker command failed with exit code 1 (use -v to see invocation)

    These 2 errors I get after I declare/define the setters and getters in myControllerFactory CLASS. The problem is not there if I only declare the slot cppButtonSlot(buttonId).
    Here is the complete code so far related to my problem.

    If anyone could help, would be really really really helpful.
    I am a beginner in C++, so I may have stupid mistakes in the code.

    Thank you all for your help.

    MAIN.CPP

    @//set current configuration and workflow here
    QString currentConfiguration = "declipseSPECTgrouped";
    int currentWorkflow = 3;

    //set current configuration and workflow in C++
    controllerFactory myController;
    myController.setCurrentConfiguration(currentConfiguration);
    myController.setCurrentWorkflow(currentWorkflow);
    @

    controllerFactory.h

    @#ifndef CONTROLLERFACTORY_H
    #define CONTROLLERFACTORY_H

    //include here
    #include <QString>
    #include <QObject>
    #include <QDebug>

    class controllerFactory : public QObject
    {
    Q_OBJECT

    public:
    //contructor
    controllerFactory();

    //getters
    QString getCurrentConfiguration();
    int getCurrentWorkflow();

    //setters
    void setCurrentConfiguration(QString currentConfiguration);
    void setCurrentWorkflow (int currentWorkflow);

    public slots:
    //slots
    void cppButtonSlot(QString &buttonId);
    void cppSliderSlot(QString &sliderId);
    void cppLabelSlot(QString &labelId);
    void cppSwitchSlot(QString &switchId);

    private:
    int _currentWorkflow;
    QString _currentConfiguration;
    };

    #endif // CONTROLLERFACTORY_
    @

    controllerFactory.CPP

    @#include "controllerFactory.h"

    //constructor ---------------------------------------------------------
    controllerFactory::controllerFactory()
    {
    }

    //getters -------------------------------------------------------------
    QString controllerFactory::getCurrentConfiguration()
    {
    return _currentConfiguration;
    }

    int controllerFactory::getCurrentWorkflow()
    {
    return _currentWorkflow;
    }

    //setters -------------------------------------------------------------
    void controllerFactory::setCurrentConfiguration(QString currentConfiguration)
    {
    if (_currentConfiguration != currentConfiguration)
    {
    _currentConfiguration = currentConfiguration;
    qDebug() << "Configuration set to " << _currentConfiguration;
    }
    }

    void controllerFactory::setCurrentWorkflow (int currentWorkflow)
    {
    if (_currentWorkflow != currentWorkflow)
    {
    _currentWorkflow = currentWorkflow;
    qDebug() << "Workflow changed to " << _currentWorkflow;
    }
    }

    //slots ---------------------------------------------------------------
    void controllerFactory::cppButtonSlot(QString &buttonId)
    {
    qDebug() << "cppButtonSlot received button ID: "<< buttonId;

    //NEXT workflow button, neccessary to manually switch phases
    if (buttonId == "nextWorkflowButton")
    {
    _currentWorkflow ++;
    qDebug() << "Current Workflow: "<< _currentWorkflow;
    }
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.