Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Does anyone know how to solve this error I get in c++
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 586 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mshefiti
    wrote on last edited by
    #1

    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;
    }
    }
    @

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved