Hi!
I'm trying to develop a simple calculator. I'm using Qt Creator. I've already designed a form, but now I have a problem with slot. It calls, when i push the button with digit and adds the digit to lcd. I think everything is ok, but i get compiler's errors. Here is the source code:
Qt Code:
  1. //calc.h
  2.  
  3. #ifndef CALC_H
  4. #define CALC_H
  5.  
  6. #include <QtGui/QDialog>
  7.  
  8. namespace Ui
  9. {
  10. class Calc;
  11. }
  12.  
  13. class Calc : public QDialog
  14. {
  15. Q_OBJECT
  16.  
  17. public:
  18. Calc(QWidget *parent = 0);
  19. ~Calc();
  20.  
  21. slots:
  22. void setVal(const int &val);
  23.  
  24. private:
  25. Ui::Calc *ui;
  26. };
  27.  
  28. #endif // CALC_H
To copy to clipboard, switch view to plain text mode 


Qt Code:
  1. //calc.cpp
  2. #include "calc.h"
  3. #include "ui_calc.h"
  4.  
  5. Calc::Calc(QWidget *parent)
  6. : QDialog(parent), ui(new Ui::Calc)
  7. {
  8. ui->setupUi(this);
  9. }
  10.  
  11. Calc::~Calc()
  12. {
  13. delete ui;
  14. }
  15.  
  16. void Calc::setVal(const int &val){
  17.  
  18. lcdNumber-> intValue*=10;
  19. lcdNumber -> intValue+=val;
  20. }
To copy to clipboard, switch view to plain text mode 


And these are the errors:
calc.h:16: error: expected primary-expression before ‘void’
calc.h:16: error: ISO C++ forbids declaration of ‘type name’ with no type
calc.h:16: error: expected ‘;’ before ‘void’
calc.cpp:11: error: no ‘void Calc::setVal(const int&)’ member function declared in class ‘Calc’
Please help me
Regards
Stefek