Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38566

Compile time error due to use of obj-c keyword "id" and missing header (OSX 10.6)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.3.0 Beta1
    • GUI: Printing
    • None
    • OSX 10.6.8, XCode 3.2, MacOSX10.6.sdk
    • macOS

    Description

      2 compiles issues (fixed source is attached, hope this helps I don't have the time to try to setup gerrit)

      1) qprintengine_mac is using "id" which is an obj-c keyword, and appears to case an issue when using old older apple compilers:

      qtbase/src/plugins/platforms/cocoa/qprintengine_mac.mm:

      Example Compile Error:

      /Developer/usr/bin/gcc -c -pipe -g -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_EXCEPTIONS -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_PLUGIN -DQT_PRINTSUPPORT_LIB -DQT_PLATFORMSUPPORT_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../mkspecs/macx-g++ -I. -I../../../../lib/QtPrintSupport.framework/Versions/5/Headers -I../../../../lib/QtPrintSupport.framework/Versions/5/Headers/5.3.0 -I../../../../lib/QtPrintSupport.framework/Versions/5/Headers/5.3.0/QtPrintSupport -I../../../../lib/QtWidgets.framework/Versions/5/Headers -I../../../../lib/QtWidgets.framework/Versions/5/Headers/5.3.0 -I../../../../lib/QtWidgets.framework/Versions/5/Headers/5.3.0/QtWidgets -I../../../../include -I../../../../include/QtPlatformSupport -I../../../../include/QtPlatformSupport/5.3.0 -I../../../../include/QtPlatformSupport/5.3.0/QtPlatformSupport -I../../../../lib/QtGui.framework/Versions/5/Headers -I../../../../lib/QtGui.framework/Versions/5/Headers/5.3.0 -I../../../../lib/QtGui.framework/Versions/5/Headers/5.3.0/QtGui -I../../../../lib/QtCore.framework/Versions/5/Headers -I../../../../lib/QtCore.framework/Versions/5/Headers/5.3.0 -I../../../../lib/QtCore.framework/Versions/5/Headers/5.3.0/QtCore -I.moc/debug -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AGL.framework/Headers -F/Users/harrison37/Work/qt-build/qt-everywhere-opensource-src-5.3.0-beta/qtbase/lib qprintengine_mac.mm -o .obj/debug/qprintengine_mac.o
      qprintengine_mac.mm: In member function ‘virtual void QMacPrintEngine::setProperty(QPrintEngine::PrintEnginePropertyKey, const QVariant&)’:
      qprintengine_mac.mm:537: error: no matching function for call to ‘QPageSize::QPageSize(objc_object*)’
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:295: note: candidates are: QPageSize::QPageSize(QPageSizePrivate&)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:294: note: QPageSize::QPageSize(int, const QSize&, const QString&)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:293: note: QPageSize::QPageSize(const QString&, const QSize&, const QString&)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:239: note: QPageSize::QPageSize(const QPageSize&)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:238: note: QPageSize::QPageSize(const QSizeF&, QPageSize::Unit, const QString&, QPageSize::SizeMatchPolicy)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:235: note: QPageSize::QPageSize(const QSize&, const QString&, QPageSize::SizeMatchPolicy)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:232: note: QPageSize::QPageSize(QPageSize::PageSizeId)
      ../../../../include/QtGui/../../src/gui/painting/qpagesize.h:231: note: QPageSize::QPageSize()
      qprintengine_mac.mm:542: error: expected unqualified-id before ‘=’ token

      Fix:

      Change:
      case PPK_WindowsPageSize:
      d->setPageSize(QPageSize(QPageSize::id(value.toInt())));
      break;

      To:
      case PPK_WindowsPageSize:
      d->setPageSize(QPageSize(QPageSize::PageSizeId(value.toInt())));
      break;

      And replace "id" with a suitable name "pid" in:
      case PPK_PrinterName:

      { QString id = value.toString(); if (id.isEmpty()) id = QCocoaPrinterSupport().defaultPrintDeviceId(); else if (!QCocoaPrinterSupport().availablePrintDeviceIds().contains(id)) break; d->m_printDevice = new QCocoaPrintDevice(id); PMPrinter printer = d->m_printDevice->macPrinter(); PMRetain(printer); PMSessionSetCurrentPMPrinter(d->session(), printer); // TODO Do we need to check if the page size, etc, are valid on new printer? break; }

      2) Missing "MAXPATHLEN"

      qtbase/src/plugins/platforms/cocoa/qcocoaprintdevice.mm:

      Compile error:

      qcocoaprintdevice.mm: In member function ‘bool QCocoaPrintDevice::openPpdFile()’:
      qcocoaprintdevice.mm:462: error: ‘MAXPATHLEN’ was not declared in this scope
      qcocoaprintdevice.mm:465: error: ‘ppdPath’ was not declared in this scope

      Fix:

      #include <sys/param.h>, to get MAXPATHLEN

      Attachments

        For Gerrit Dashboard: QTBUG-38566
        # Subject Branch Project Status CR V

        Activity

          People

            johnlayt John Layt
            cyrush Cyrus Harrison
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes