include/linking basics...

Member
Posts: 321
Joined: 2004.10
Post: #1
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.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #2
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.
Quote this message in a reply
Member
Posts: 321
Joined: 2004.10
Post: #3
Can't Apple afford some Summer interns to update their code examples?

Seems rather short sighted.
Quote this message in a reply
Moderator
Posts: 133
Joined: 2008.05
Post: #4
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.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  StorageRoom - Include content in your games sashthebash 0 2,469 Jun 13, 2011 05:39 AM
Last Post: sashthebash
  #include &lt;ft2build.h&gt; BBBert 4 10,623 Apr 7, 2008 09:33 AM
Last Post: BBBert
  Newbie problem XCode Include files BBBert 1 4,308 Mar 17, 2008 03:46 PM
Last Post: OneSadCookie
  Fixing Include Paths vbuser1338 4 3,214 May 28, 2006 05:15 PM
Last Post: vbuser1338
  Xcode #include strangeness WhatMeWorry 4 4,483 Jul 1, 2005 12:31 AM
Last Post: DoG