Results 1 to 2 of 2

Thread: QtConcurrent::run documentation examples not compiling

  1. #1
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default QtConcurrent::run documentation examples not compiling

    Hi,

    i just discovered QtConcurrent::run and wanted to give it a try. Unfortunately, the examples from the official documentation (http://doc.qt.nokia.com/4.6/qtconcurrentrun.html) do not compile and cause a bunch of error messages.
    What i want to do is calling a non-const member function, just like in the example from the section "Using Member Functions":

    Qt Code:
    1. // call 'void QImage::invertPixels(InvertMode mode)' in a separate thread
    2. QImage image;
    3. QFuture<void> future = QtConcurrent::run(image, &QImage::invertPixels, QImage::InvertRgba);
    To copy to clipboard, switch view to plain text mode 
    that code snippet (copied from the docs) does not compile - the call to QtConcurrent::run generates the following error messages.
    1> error C2780: 'QFuture<T> QtConcurrent::run(const Class *,T (__thiscall Class::* )(Param1,Param2,Param3,Param4,Param5) const,const Arg1 &,const Arg2 &,const Arg3 &,const Arg4 &,const Arg5 &)': Erwartet 7 Argumente - 3 unterstützt
    1> c:\qt\qt-win-4.6.1-x86\include\qtcore\../../src/corelib/concurrent/qtconcurrentrun.h(283): Siehe Deklaration von 'QtConcurrent::run'
    1> error C2780: 'QFuture<T> QtConcurrent::run(const Class *,T (__thiscall Class::* )(Param1,Param2,Param3,Param4) const,const Arg1 &,const Arg2 &,const Arg3 &,const Arg4 &)': Erwartet 6 Argumente - 3 unterstützt
    1> c:\qt\qt-win-4.6.1-x86\include\qtcore\../../src/corelib/concurrent/qtconcurrentrun.h(278): Siehe Deklaration von 'QtConcurrent::run'
    1> error C2780: 'QFuture<T> QtConcurrent::run(const Class *,T (__thiscall Class::* )(Param1,Param2,Param3) const,const Arg1 &,const Arg2 &,const Arg3 &)': Erwartet 5 Argumente - 3 unterstützt
    1> c:\qt\qt-win-4.6.1-x86\include\qtcore\../../src/corelib/concurrent/qtconcurrentrun.h(273): Siehe Deklaration von 'QtConcurrent::run'
    1> error C2780: 'QFuture<T> QtConcurrent::run(const Class *,T (__thiscall Class::* )(Param1,Param2) const,const Arg1 &,const Arg2 &)': Erwartet 4 Argumente - 3 unterstützt
    1> c:\qt\qt-win-4.6.1-x86\include\qtcore\../../src/corelib/concurrent/qtconcurrentrun.h(268): Siehe Deklaration von 'QtConcurrent::run'
    1> error C2784: "QFuture<T> QtConcurrent::run(const Class *,T (__thiscall Class::* )(Param1) const,const Arg1 &)": template-Argument für "const Class *" konnte nicht von "QImage" hergeleitet werden.
    1> c:\qt\qt-win-4.6.1-x86\include\qtcore\../../src/corelib/concurrent/qtconcurrentrun.h(263): Siehe Deklaration von 'QtConcurrent::run'
    <snip>
    I have included QtConcurrentRun and QImage.
    Compiling on MS Visual Studio C++ 2008, Win7
    Qt Version: 4.6

  2. #2
    Join Date
    Nov 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QtConcurrent::run documentation examples not compiling (INVALID)

    Post is invalid - our build system uses a custom MOC which causes the problem. Code compiles just fine when using a "normal QT" project.

Similar Threads

  1. Replies: 1
    Last Post: 3rd October 2010, 18:41
  2. Network examples are nto compiling
    By pakkko in forum Qt Programming
    Replies: 0
    Last Post: 3rd August 2010, 15:16
  3. Problem compiling Qt4.4.0 with mingw-static in examples/webkit
    By KjellKod in forum Installation and Deployment
    Replies: 2
    Last Post: 10th July 2008, 13:32
  4. Problem cross compiling examples/demo on mips.Qmake/Linking?
    By Cursedbeasty in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th July 2007, 10:53
  5. Adding Qt's documentation to Xcode documentation browser
    By fabietto in forum Qt Programming
    Replies: 0
    Last Post: 10th June 2007, 15:38

Tags for this Thread

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.