Results 1 to 7 of 7

Thread: Problem with MultiThread..

  1. #1
    Join Date
    Sep 2008
    Posts
    38
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Question Problem with MultiThread..

    i have made out a thread for data processing,

    I want to read a series data (QPointF) from local harddisk,once a new data comes then tell the main thread to draw the new point,
    signal:
    newDataCome(QPointF newpoint);

    there are nothing like QMutex, QReadWriteLock, QWaitCondition in the qthread ,

    than a made a extern object of thread

    extern ProcessThread processthread;

    but after building there is a error by this row:
    connect(&processthread, SIGNAL(newDataCome(QPointF)), this, SLOT(paintNewPoint(QPoint)));

    and the error code is:
    undefined reference to `_processthread`

    i don`t unterstand what is a _processthread?

    thanks for your help!!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with MultiThread..

    Where do you declare the actual variable? "extern" means that the variable is available in a different translation unit. Anyway, I'd recommend not to use global variables at all. Why not just declare it as a member variable of some class which manages the thread?
    J-P Nurmi

  3. #3
    Join Date
    Sep 2008
    Posts
    38
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with MultiThread..

    Quote Originally Posted by jpn View Post
    Where do you declare the actual variable? "extern" means that the variable is available in a different translation unit. Anyway, I'd recommend not to use global variables at all. Why not just declare it as a member variable of some class which manages the thread?
    thanks,

    in a header file i have declared the Qthread class,
    processthread.h

    the ProcessThread is used for dataprocess, and will be involked by many instances, so is a "extern"

    anyway i don`t unterstand, where come from the "_processthread" ??

  4. #4
    Join Date
    Sep 2008
    Posts
    38
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with MultiThread..

    new error,
    now i declare the processthread as a member variable ,

    but the error description is changed as follows:

    field`processthread`has incomplete type,

    what`s meas for that?

  5. #5
    Join Date
    Sep 2008
    Posts
    11
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with MultiThread..

    Could you post some minimal code example that might aid to understand what the problem is?

    cheers,
    --to

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem with MultiThread..

    Quote Originally Posted by blm View Post
    new error,
    now i declare the processthread as a member variable ,

    but the error description is changed as follows:

    field`processthread`has incomplete type,

    what`s meas for that?
    #include <QThread>
    J-P Nurmi

  7. #7
    Join Date
    Sep 2008
    Posts
    38
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem with MultiThread..

    at last i find a solution,

    previous i write
    #include "processthread.h"
    in Plotter.cpp

    now i write it in Plotter.h,
    and declared the processthread class as a member variable in Plotter.

    but i still don`t unterstand what`s the difference

Similar Threads

  1. Problem in using QHttp with QTimer
    By Ferdous in forum Newbie
    Replies: 2
    Last Post: 6th September 2008, 12:48
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  4. Problem about timer in multithread programs
    By vql in forum General Programming
    Replies: 4
    Last Post: 17th October 2007, 15:00
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.