Results 1 to 4 of 4

Thread: Error compiling Qt3 app with Boost signals support

  1. #1

    Default Error compiling Qt3 app with Boost signals support

    I wrote a simple Networking library that uses Boost on Linux (Fedora Core 6). I thought I'd try and add a Qt3 front end, but when I compile I get a weird error:

    Qt Code:
    1. /usr/include/boost/signals/detail/signals_common.hpp:26: error: expected identifier before protected
    2. /usr/include/boost/signals/detail/signals_common.hpp:26: error: expected unqualified-id before protected
    3. main.cc:20: error: expected `}' at end of input
    To copy to clipboard, switch view to plain text mode 

    The Boost header file is:

    http://boost.cvs.sourceforge.net/boo...11&view=markup

    Any ideas?

  2. #2
    Join Date
    Feb 2006
    Posts
    32
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Error compiling Qt3 app with Boost signals support

    You are probably running into some precompiler problems. QT defines some macros, and they might conflict with boost method names. I had the same problem when using a library which used "sigc++". You have to make sure, that the boost headers are included, before QT defines their macros (emit, signal, slot,...).

    For my project there is a file called "workarounds.h" which includes the relevant files. workarounds.h is included by giving the compiler a command line option "gcc -include workarounds.h". (Actually the solution was written by someone else, who helped me on my project).

    Qt Code:
    1. #ifndef PACKAGESEARCH_WORKAROUNDS_H
    2. #define PACKAGESEARCH_WORKAROUNDS_H
    3.  
    4. /*
    5.  * Workarounds for symbol clashes
    6.  */
    7.  
    8. /*
    9.  * emit is a #define in qt and a method name in sigc++, so you have to include
    10.  * it before qt-anything
    11.  */
    12. #include <sigc++/sigc++.h>
    13.  
    14. /*
    15.  * QT makes use of a GC symbol, which is also defined by libgc, that gets
    16.  * included by wibble, that gets included by ept
    17.  */
    18. #define GC QT_GC_WORKAROUND
    19. #include <qwindowdefs.h>
    20. #include <qpainter.h>
    21. #undef GC
    22.  
    23. #endif
    To copy to clipboard, switch view to plain text mode 
    Last edited by bmesing; 1st May 2007 at 17:33. Reason: clarified content

  3. #3

    Default Re: Error compiling Qt3 app with Boost signals support

    That's what I thought - I include my own header file first in the Qt app I'm writing. It doesn't make a difference which order I include them.

    Thanks

  4. #4
    Join Date
    Apr 2007
    Posts
    17
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Re: Error compiling Qt3 app with Boost signals support

    Boost has an answer to this in their FAQ:

    http://www.boost.org/doc/html/signal...html#id2738878

    We're using the latter solution in our project, and it seems to work fine so far.
    Qpsycle -- open-source modular music studio built with Qt

Similar Threads

  1. Compile QT4.2.2 with MySQL on Mac OS
    By asd in forum Installation and Deployment
    Replies: 7
    Last Post: 12th February 2007, 14:50

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.