PDA

View Full Version : Using Mac Frameworks in Qt App



yogeshgokul
4th February 2008, 07:36
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

jpn
4th February 2008, 07:49
Is "DRDevice" declared in DiscRecording.h? Where is DiscRecording.h? Perhaps you should add

INCLUDEPATH += /path/to/DiscRecording/includes
to your .pro file?

yogeshgokul
4th February 2008, 08:31
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.

jpn
4th February 2008, 08:49
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

yogeshgokul
4th February 2008, 09:06
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

jpn
4th February 2008, 10:59
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?


LIB_NAME = DiscRecording
FRAMEWORK_PATH = /System/Library/Frameworks

FRAMEWORK_INCLUDE = $${FRAMEWORK_PATH}/$${LIB_NAME}.framework/headers # Headers or headers??
exists($$FRAMEWORK_INCLUDE) {
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
}
LIBS += -framework $${LIB_NAME}


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".

yogeshgokul
4th February 2008, 11:15
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?


LIB_NAME = DiscRecording
FRAMEWORK_PATH = /System/Library/Frameworks

FRAMEWORK_INCLUDE = $${FRAMEWORK_PATH}/$${LIB_NAME}.framework/headers # Headers or headers??
exists($$FRAMEWORK_INCLUDE) {
INCLUDEPATH -= $$FRAMEWORK_INCLUDE
INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
}
LIBS += -framework $${LIB_NAME}


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

jpn
4th February 2008, 11:32
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.

yogeshgokul
4th February 2008, 12:23
Please find the attached 2 files containing build output and output of command.

jpn
4th February 2008, 12:59
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?

yogeshgokul
7th February 2008, 08:30
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

jpn
7th February 2008, 08:34
Would you mind attaching DiscRecording.h?

TimButterfield
8th February 2008, 07:20
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.

THRESHE
8th February 2008, 15:19
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 :)

TimButterfield
9th February 2008, 00:33
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.

THRESHE
9th February 2008, 11:50
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 ;)

TimButterfield
10th February 2008, 04:15
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.