Results 1 to 9 of 9

Thread: connect() terminates the program

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default connect() terminates the program

    I get a weird program termination when I use connect() in my code. I checked the code properly, i don't know where the mistake comes from:

    I call construct the control object in MainWindow and call its init()
    Qt Code:
    1. void Control::initObjects()
    2. {
    3. logger = new ErrorLogger();
    4.  
    5. X = new Xr();
    6.  
    7. Y = new Y();
    8.  
    9. Z = new Z();
    10.  
    11. rs_485 = new rs485();
    12.  
    13. establishConnections();
    14. }
    15.  
    16. void Control::establishConnections()
    17. {
    18. connect(X , SIGNAL(logMessage(const char* )), logger, SLOT(logMessage(const char* )));
    19. connect(Y , SIGNAL(logMessage(const char* )), logger, SLOT(logMessage(const char* )));
    20. connect(Z , SIGNAL(logMessage(const char* )), logger, SLOT(logMessage(const char* )));
    21. connect(rs485 , SIGNAL(logMessage(const char* )), logger, SLOT(logMessage(const char* )));
    22. }
    To copy to clipboard, switch view to plain text mode 

    the last connect terminates my program, thought the first 3 work properly.

  2. #2
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: connect() terminates the program

    Can't be because of rs485!!?? because you've made an object with name of rs_485. but you have used it with name of rs485 which is the class name. That could be the mistake

  3. #3
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: connect() terminates the program

    Quote Originally Posted by alizadeh91 View Post
    Can't be because of rs485!!?? because you've made an object with name of rs_485. but you have used it with name of rs485 which is the class name. That could be the mistake
    That was changed after pasting. it still jumps out when it is run.

  4. #4
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: connect() terminates the program

    Seems somethings wrong with rs_485. Can't tell what is it unless you provide a simple example (attach simple source code)

Similar Threads

  1. Replies: 3
    Last Post: 29th January 2014, 12:03
  2. Replies: 6
    Last Post: 25th November 2010, 21:02
  3. Replies: 8
    Last Post: 26th March 2010, 12:45
  4. program cannot connect to X server
    By Wazman in forum Qt Programming
    Replies: 3
    Last Post: 1st September 2009, 19:28
  5. how can i connect program to phonism
    By motsh in forum Qt Programming
    Replies: 0
    Last Post: 6th May 2009, 15:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.