Need some help with carbon/cocoa

I have a problem. I am building an application in Cocoa that needs to use Carbon functions. My application is a MP3 player that is using QuickTime. I am using the code provided by Apple as found here: http://developer.apple.com/samplecode/SimpleCocoaMovie/SimpleCocoaMovie.html

Apple's example compiles and runs just fine, however, when I try compiling it in my own application, it has errors. The first error I get out of the 13,686 errors I get says this:
Code:
undefined type, found '@class'
When I click on it, it takes me to a line in a file called "NSObjCRuntime.h" that says "@class NSString;". It appears to be the definition for the cocoa NSString class.

The source code for the Carbon file which has the 13,686 errors is here: http://developer.apple.com/samplecode/SimpleCocoaMovie/listing4.html

My application compiles and runs perfectly without the Carbon file.

I should also mention that I am fairly new to programming on the Mac. Can anyone help me out with this? I am completely lost.

Thank you!
 
Did you include the required headers?

#include <Carbon/Carbon.h>
#include <QuickTime/QuickTime.h>
#include <AppKit/AppKit.h>

#include "QTUtils.h"

It's really tough to say what's going on without seeing source code -- to take a stab at it, are you sure you didn't make 13,686 typos? ;)
 
Just a shot in the dark. It might be that the compiler is not aware that it is compiling an objective-C source. I would guess that the compiler identifies the source type using the file extetion of the source. Is yor source a .m file?
 
ElDiabloConCaca said:
Hmm... without seeing some source, that's gonna be a hard one to diagnose.

I'm just using the code (unmodified) as on Apple's website. You can find it here: http://developer.apple.com/samplecode/SimpleCocoaMovie/SimpleCocoaMovie.html

CharlyM said:
Just a shot in the dark. It might be that the compiler is not aware that it is compiling an objective-C source. I would guess that the compiler identifies the source type using the file extetion of the source. Is yor source a .m file?

I think you're right about it identifying the sources by the extension. The cocoa file is a .m file and the carbon file is a .c file.
 
Back
Top