PDA

View Full Version : include/linking basics...


WhatMeWorry
2005.06.22, 12:51 PM
This area is always biting me, and I must be doing something basically wrong.

I download an Apple code example. I'm interested in stepping though the code
to learn what's going on, and I also want to get familiar with Xcode as well, so
I create a new project and populate it with the downloaded files.

I'm down to just one compile error:

FilterExport.c:20: error: parse error before "GWorldPtr"

PixMapHandle hPixMap = GetGWorldPixMap(static_cast<GWorldPtr>(inDataPtr));

Ok, I don't have a declaration of the data type PixMapHandle

So I go to Apple developer documentation and find the PixMapHandle in
QuickDraw Reference Document. It says

-------------------------------------------------------------------------

Framework: ApplicationServices/ApplicationsServices.h

Header: Quickdraw.h QDOffscreen.h QDPictToCGContext.h

Availability
Available in CarbonLib 1.0 and later when running Mac OS 8.1 or later. Available in
Mac OS X version 10.0 and later.

-------------------------------------------------------------------------

Alright, so I try to #include <Quickdraw.h>

and I tried #include <QD/Quickdraw.h>

(by the way, what is the QD/ in front of Quickdraw? That's not a directory is it?)

and I get error message: Quickdraw.h: No such file or directory

And I've tried all the other headers above. I even tried including <ApplicationServices/ApplicationsServices.h>

So I'm stuck. What would a reasonable (that is, not me) person do
in this situation?

-----------------------------------------------------------------------

As an aside, I did get the following bit of code to compiling

#include <QuickTime/QuickTime.h> // declares/defines GraphicsImportComponent
GraphicsImportComponent backgroundImporter = 0, foregroundImporter = 0;

So I go into the Finder and pull up all the QuickTime.h files on my system.
Inside then, some have just the the one line:
#include <QuickTime/QuickTime.h>

Others have
#ifndef __CARBON__
#include <Carbon/Carbon.h>
#endif

followed by even more includes.

LongJumper
2005.06.22, 07:46 PM
Alot of that code is outdated, so the header files names may have changed, or the directory it is in may be different. At one point, QD was probably the name of a directory which stores quicktime.h. It isn't anymore, I'm fairly sure it's Quicktime/Quicktime.h. The Quicktime/ to get into the framework, the Quicktime.h to get the correct header.

WhatMeWorry
2005.06.22, 08:37 PM
Can't Apple afford some Summer interns to update their code examples?

Seems rather short sighted.

LongJumper
2005.06.22, 09:00 PM
The code is just sample code. It's there for learning purposes, not to make an application with. Most people can figure out where their header files are, or realize that the sample code is deprecated. If coding were just copying and pasting, anyone could do it. You gotta do some research on what you're doing, and if Apple's sample code is one of your resources, you need to make sure that it is modern.