0

pleeeease help. I am trying to create a GUI that simply returns the users input back to the console output. I have the GUI and regular expressions working but when i click add my program crashes.

i have run debugging and get the error in the subject line I have done some research and learned it has something to do with pointers and memory but cannot see the problem in my code. i have included the parts of my code related to line 63 returning the error

header file:

private:
    QString number;
    QString module;
    QString mark;
    QLineEdit *StudentNumber;
    QLineEdit *ModuleCode;
    QSpinBox *Mark;
    Ui::GetStudent *ui;

cpp:

void GetStudent::on_button1clicked()
{
   QString number=StudentNumber->text();
   QString module=ModuleCode->text();
   QString mark=Mark->text();



 QString response = QString ("The info you entered has been validated and is: \n Student: %1 \n Module: %2 \n Mark: %3").arg(number).arg(module).arg(mark);
   QTextStream out(stdout);
   out << response;
   out.flush();
 }

debugging logs:

Debugging starts
can't find linker symbol for virtual table for `QTextStream' value
  found `_q_ObjectMutexPool' instead
can't find linker symbol for virtual table for `QTextStream' value
  found `_q_ObjectMutexPool' instead
  • 1
    Please post a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). How are the pointers initialized? – MikeCAT Jun 14 '21 at 17:28
  • 1
    just to add, this is line 63: QString number=StudentNumber->text(); – laviane du plessis Jun 14 '21 at 17:32
  • 1
    QLineEdit *StudentNumber = new QLineEdit(this); – laviane du plessis Jun 14 '21 at 17:33
  • If you *really* have `QLineEdit *StudentNumber = new QLineEdit(this);` in your constructor then that's the problem: you create and initialize a local variable with the same name as the class member `StudentNumber` which will remain uninitialized. – G.M. Jun 14 '21 at 17:56
  • thank you @G.M.. i am still learning C++ and QT so I dont know where to put this code whenever I try to put it anywhere else the program crashes – laviane du plessis Jun 14 '21 at 19:58

0 Answers0