How to build qtmultimedia for OS X

  • I've been unable to get qtmultimedia to build for OS X. This is what I tried:

    • cloned the git repository (git://,
    • qmake -spec macx-clang ../qtmultimedia/
    • make

    It seems to compile the c/c++ code just fine but chokes on the objective c code. I get several errors. Some examples:
    /Applications/ error: expected
    @class NSString, NSMethodSignature, NSInvocation;

    /Applications/ error:
    unknown type name 'NSString'; did you mean 'QString'?
    FOUNDATION_EXPORT Class NSClassFromString(NSString *aClassName);@

    It appears to be trying to compile the objective c code as c++. What am I doing wrong? Any help?

  • Moderators

    Qt Multimedia is part of Qt 5, you do not need to compile it separately. Which version of Qt are you using?

  • I'm using Qt 5.3.

    It is included and working fine but the AVFoundation plugin backend is severely lacking in some areas. My project requires a couple enhancements to the camera capture code so I am going to make those enhancements and submit patches back to the maintainers.

    I've already made these enhancements to the Windows (DirectShow) back end and it works great...just need to figure out how to get it to compile on OS X now.

  • Moderators

    Ah, ok. It might be that you need some other modules present (definitely QtCore, so qtbase repo, plus probably QtGui). But if you compiled it on Windows successfully, then you probably know the drill.

    I suggest asking on development mailing list, or the IRC. Those are the 2 places where developers of Qt reside.

  • Lifetime Qt Champion


    Since you are adding new functionality, you should first checkout the dev branch

  • Try building all of Qt5, you can find instructions there:

    You can skip QtWebkit with the option --no-webkit when running the init-repository script. You don't need it and it takes a while to build...

    As mentioned, if you plan to submit new features, you need to do it on the dev branch. You can find some instructions and guidelines there:

  • I was being stupid. I added a file in the AVFoundation plugin with .cpp extension that also imported objective c headers. duh.

    After renaming it to .mm it compiles just fine.

    I've checked out the dev branch, read the contribution guidelines and will be submitting a patch for review shortly.


Log in to reply