Results 1 to 17 of 17

Thread: Using Mac Frameworks in Qt App

  1. #1
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Using Mac Frameworks in Qt App

    I am using Mac's framework named "System/Library/Frameworks/DiscRecording.framework" in my qt App. For this I added 2 lines in .pro file.

    QMAKE_LFLAGS += -L/System/Library/Frameworks/DiscRecording
    LIBS += -framework DiscRecording

    In one of my header file I included this framework e.g
    #include "DiscRecording/DiscRecording.h" // Including master header file for the framework

    but when I try to create object of one of the class on that framework "e.g DRDevice obj", I am getting this error:
    "error: 'DRDevice' does not name a type"

    How to remove this error

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    Is "DRDevice" declared in DiscRecording.h? Where is DiscRecording.h? Perhaps you should add
    INCLUDEPATH += /path/to/DiscRecording/includes
    to your .pro file?
    J-P Nurmi

  3. #3
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using Mac Frameworks in Qt App

    DiskRecording.h is master header file for this framework. So we only need to include this file to have all the functionality of that framework(with all header files included).

    And I tried this INCLUDEPATH method. Didnt work.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    Could you answer my question? Exactly where is DiscRecording.h?

    Let's imagine DiscRecording.h is in "/path/to/DiscRecording/DiscRecording.h". Now, if you include "DiscRecording/DiscRecording.h", you should add
    INCLUDEPATH += /path/to
    But if you include "DiscRecording.h", you should add
    INCLUDEPATH += /path/to/DiscRecording
    J-P Nurmi

  5. #5
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using Mac Frameworks in Qt App

    Hi jpn,

    I am sorry if I could not make myself clear. The answer to your question is:
    DiscRecording.h is in /System/Library/Frameworks/DiscRecording.framework/headers folder.

    You can check this framework in /System/Library/Frameworks folder on mac machine.

    BTW, I don't get any file include error. When I say
    #include "DiscRecording/DiscRecording.h"
    it can very well include the file. Only problem that I understand is that it is not able to properly include its inner frameworks like DiscRecordingEngine and DiscRecordingContent.

    I have studied qt assistant about how to include frameworks in qt projects on mac and doing the same way. I will be very great full if somebody can help me right here!! :-)

    Regards,
    Yogesh

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    Quote Originally Posted by yogeshgokul View Post
    I am sorry if I could not make myself clear. The answer to your question is:
    DiscRecording.h is in /System/Library/Frameworks/DiscRecording.framework/headers folder.
    Are you sure it's "headers"? Or is it "Headers"? Your file system is case sensitive, right?

    You can check this framework in /System/Library/Frameworks folder on mac machine.
    Unfortunately I don't have a Mac.

    BTW, I don't get any file include error. When I say
    #include "DiscRecording/DiscRecording.h"
    it can very well include the file. Only problem that I understand is that it is not able to properly include its inner frameworks like DiscRecordingEngine and DiscRecordingContent.
    Well, presumably something goes wrong if the type is declared in that header but it's still unknown after trying to include the header file.

    Does this work?
    Qt Code:
    1. LIB_NAME = DiscRecording
    2. FRAMEWORK_PATH = /System/Library/Frameworks
    3.  
    4. FRAMEWORK_INCLUDE = $${FRAMEWORK_PATH}/$${LIB_NAME}.framework/headers # Headers or headers??
    5. exists($$FRAMEWORK_INCLUDE) {
    6. INCLUDEPATH -= $$FRAMEWORK_INCLUDE
    7. INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
    8. }
    9. LIBS += -framework $${LIB_NAME}
    To copy to clipboard, switch view to plain text mode 

    Presumably you should try with include "DiscRecording.h" since you say the file is in "/System/Library/Frameworks/DiscRecording.framework/headers/DiscRecording.h". However, it would be include "DiscRecording/DiscRecording.h" if it was in "/System/Library/Frameworks/DiscRecording.framework/headers/DiscRecording/DiscRecording.h".
    J-P Nurmi

  7. #7
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using Mac Frameworks in Qt App

    Quote Originally Posted by jpn View Post
    Are you sure it's "headers"? Or is it "Headers"? Your file system is case sensitive, right?

    It is "Headers", but it does not make any difference as we can not write it in include path. All header files are automatically included by DiscRecording.h file and the framework have multiple sub frameworks having multiple Headers folders.


    Unfortunately I don't have a Mac.


    Well, presumably something goes wrong if the type is declared in that header but it's still unknown after trying to include the header file.

    Does this work?
    Qt Code:
    1. LIB_NAME = DiscRecording
    2. FRAMEWORK_PATH = /System/Library/Frameworks
    3.  
    4. FRAMEWORK_INCLUDE = $${FRAMEWORK_PATH}/$${LIB_NAME}.framework/headers # Headers or headers??
    5. exists($$FRAMEWORK_INCLUDE) {
    6. INCLUDEPATH -= $$FRAMEWORK_INCLUDE
    7. INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
    8. }
    9. LIBS += -framework $${LIB_NAME}
    To copy to clipboard, switch view to plain text mode 

    Above solution can not work for the reason that framework has multiple sub frameworks with multiple Headers folders.

    Presumably you should try with include "DiscRecording.h" since you say the file is in "/System/Library/Frameworks/DiscRecording.framework/headers/DiscRecording.h". However, it would be include "DiscRecording/DiscRecording.h" if it was in "/System/Library/Frameworks/DiscRecording.framework/headers/DiscRecording/DiscRecording.h".
    I tried this but then it give the error "No such file" for DiscRecording.h

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    Could you attach the output of
    ls -laR /System/Library/Frameworks/DiscRecording.framework
    AND the full compiler command including all switches before the "no such file" message.
    J-P Nurmi

  9. #9
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using Mac Frameworks in Qt App

    Please find the attached 2 files containing build output and output of command.
    Attached Files Attached Files

  10. #10
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    So, it seems to be "Headers", not "headers" as you said..... Spot my comment "# Headers or headers??" and fix it. Also, could you answer to my very first question? Are you sure "DRDevice" is even declared in DiscRecording.h or in its further includes?
    J-P Nurmi

  11. #11
    Join Date
    Dec 2007
    Posts
    628
    Thanks
    3
    Thanked 89 Times in 87 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Using Mac Frameworks in Qt App

    Yes DRDevice is included in header files. And as I mentioned that this is umbrella framework, so we only need to include single master header file in our project.
    I am still struggling in same problem described in 1st post of this thread

  12. #12
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Using Mac Frameworks in Qt App

    Would you mind attaching DiscRecording.h?
    J-P Nurmi

  13. #13
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Mac Frameworks in Qt App

    If I understand what you are trying to do, it seems like you are trying to use the DiscRecording classes directly from C++. IIRC, DiscRecording is part of the Cocoa framework and is written in Objective-C, not C++. I have not tried this with Qt, but you may need to do the equivalent of writing C callable wrapper functions for the objective-C objects. The Cocoa-Carbon integration guide may help you with this.

  14. #14
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Mac Frameworks in Qt App

    And why don't you want to create Xcode project and just simply add this framework to your Xcode project ? I'm using this framework right now with Xcode
    C++ & AMD forever

  15. #15
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Mac Frameworks in Qt App

    Quote Originally Posted by THRESHE View Post
    I'm using this framework right now with Xcode
    Just curious...
    Are you able to use it directly with Qt or did you need to create a wrapper like I suspected?

    Thanks.

  16. #16
    Join Date
    Mar 2007
    Location
    Ukraine, Odessa
    Posts
    140
    Thanks
    15
    Thanked 11 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Mac Frameworks in Qt App

    Quote Originally Posted by TimButterfield View Post
    Just curious...
    Are you able to use it directly with Qt or did you need to create a wrapper like I suspected?
    Thanks.
    No I've just used C functions from DiscRecording framework. Carbon API is implemented not just in Objective-C but also has implementation in C language If you are interested I can provide you with useful links on ADC
    C++ & AMD forever

  17. #17
    Join Date
    Feb 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Using Mac Frameworks in Qt App

    Quote Originally Posted by THRESHE View Post
    No I've just used C functions from DiscRecording framework. Carbon API is implemented not just in Objective-C but also has implementation in C language If you are interested I can provide you with useful links on ADC
    I'm an ADC Select member; it's probably on my Feb. DVD. I think I can find it. Thanks.

    On second thought... since it is on this thread, perhaps the links could be of use for yogeshgokul's issue.

Similar Threads

  1. Distributing QT application for Mac OS
    By mb0 in forum Qt Programming
    Replies: 1
    Last Post: 31st May 2007, 18:59
  2. Replies: 15
    Last Post: 21st April 2007, 17:46
  3. Replies: 4
    Last Post: 7th March 2006, 08:52

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.