user2180977
user2180977

Reputation: 411

Build problems with Xcode 5.0 and Qt 5.1.1 on OS X 10.8.5

I am building code that builds fine with Xcode 4.x, Qt 5.0.1 on OS X 10.8.5 but I just upgraded Xcode and Qt and I can no longer build anything when pulling in Qt headers.

The problem is that the QtSharedPointer class uses std::forward but as far as I can tell, OS X 10.8.5/Xcode 5.0 still does not support std::forward. It's not defined anywhere in the standard library that ships with it, so, when I try to build, I get this error:

In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Headers/QAction:1:                                                          
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Headers/qaction.h:47:                                                       
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:49:                                                       
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Headers/qpalette.h:47:                                                          
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Headers/qbrush.h:53:                                                            
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtGui.framework/Headers/qpixmap.h:49:                                                           
In file included from .../Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Headers/qsharedpointer.h:50:                                                   
.../Qt5.1.1/5.1.1/clang_64/lib/QtCore.framework/Headers/qsharedpointer_impl.h:411:36: error: no template named 'forward' in namespace 'std'; did you mean 'boost::forward'?
        new (result.data()) T(std::forward<Args>(arguments)...);                                                                                     
                            ~~~~~^~~~~~~                                                                                                             
                            boost::forward                                                                                                           
/usr/local/include/boost/move/utility.hpp:176:21: note: 'boost::forward' declared here                                                               
        inline T&& forward(U&& t                                                                                                                     
                    ^                                                                                                                                

I did notice these lines at the top of the header for QtSharedPointer:

#if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES)                                                                            
#  include <utility>           // for std::forward                                                                                                       
#endif

But further below (line 411), it just uses std::forward without checking if those macros are defined

    // now initialize the data
    new (result.data()) T(std::forward<Args>(arguments)...);

Those macros are actually undefined, so, I initially forced the inclusion of utility but since I later found out that std::forward is not in there, it didn't help.

It seems like a Qt bug and I intend to file it over there but has anyone figured out a workaround?

Upvotes: 1

Views: 721

Answers (1)

user2180977
user2180977

Reputation: 411

Actually, I realized that the entire method where std::forward is used is guarded by another ifdef that checks for Q_COMPILER_RVALUE_REFS. I simply edited the QtCore.framework/Versions/5/Headers/qcompilerdetection.h and manually undefed Q_COMPILER_RVALUE_REFS and that got me building.

Upvotes: 1

Related Questions