Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Can't include Processes.h

Can't include Processes.h
Thread Tools
rslifka
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Sep 30, 2005, 12:11 AM
 
Hi all,

Trying to use some of the methods (spefically GetCurrentProcess) in Processes.h, but Xcode can't find it. It can find all of the frameworks (e.g. Carbon/Carbon.h) but when I try to include Processes.h it says not found.

Any ideas?

[edit]Processes.h is only a stub

#include <ApplicationServices/ApplicationServices.h>

Adding this to my file still leaves me unable to locate GetCurrentProcess.
[/edit]

Thanks,

Rob
     
Dair Grant
Fresh-Faced Recruit
Join Date: Jan 2002
Status: Offline
Reply With Quote
Sep 30, 2005, 03:46 AM
 
If you use File->Open Quickly to open Processes.h, which file gets opened? If you're seeing the version under /Developer/Headers/FlatCarbon/Processes.h then it sounds like your project has modified its Header Search Paths to look there for headers?

Starting with a new Carbon Application project in Xcode, Open Quickly brings up the following:

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/
HIServices.framework/Versions/A/Headers/Processes.h

And pasting the following into main.c works:

ProcessSerialNumber thePSN;
OSStatus theErr;

theErr = GetCurrentProcess(&thePSN);

I would check the options you've customised in your project/target's settings, and see if anything related to headers has been modified. Failing which, create a new project and confirm that can find it - if it can't, perhaps your Xcode install is broken?

I believe there was a QuickTime SDK recently which incorrectly deleted some headers, and which requires a reinstall of Xcode to bring them back.
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Sep 30, 2005, 10:54 AM
 
Thanks for the detailed reply! This is my first Mac application, and I've chosen something typically not my forte (I'm an interaction designer / developer in Java). I'm working on understand someone else's low-level device communication code as my first foray into Carbon



I typed "Processes.h" into Open Quickly and the correct one came up, so it sounds like my project settings must be bunk. Also, I reinstalled Xcode from the Tiger CD before I even started, because it would crash when I tried to create a new project, and have installed nothing since. I believe I used "command line tool" to create this project because that's all it is.

I can find the Activity Window (Window -> AW) but not the Info Window. When I was going through the Cocoa tutorial, it was under Windoow, but I don't see it there now. According to the Xcode manual, the build info window is where you can change these settings.

Rob
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Sep 30, 2005, 10:58 AM
 
Found it! Under target -> Get Info.

All of the Search Paths entries under the Build tab are empty.

(1) Is that normal?

(2) This can't be all the search paths because I'm still able to pick up all of the Frameworks (e.g. Carbon/Carbon.h, ApplicationServices/ApplicationServices.h, etc.).

(3) Seems like including the HIServices framework would do the trick, but I'm getting a file not found when I try to include it - #include HIServices/HIServices.h>

Perhaps not using the Carbon project from New Project is my problem? I'll give that a shot when I get home.

Thanks for your help!

Rob
( Last edited by rslifka; Sep 30, 2005 at 11:12 AM. )
     
Dair Grant
Fresh-Faced Recruit
Join Date: Jan 2002
Status: Offline
Reply With Quote
Sep 30, 2005, 11:56 AM
 
Including <Carbon/Carbon.h> will automatically pull in ApplicationServices.h for you (which pulls in HIServices.h, which pulls in Processes.h) so you shouldn't need any additional headers.

Xcode projects specify build settings at the project level and at the target level: the target settings override the project settings, and you can get both windows via the Project menu's "Edit Project Settings" and "Edit Active Target" items.

Xcode will automatically look for headers in any frameworks you're linking to - a new Carbon project starts off with Carbon.framework, CoreServices.framework, and ApplicationServices.framework in the project which allows it to find Processes.h even if the Header Search Paths don't list it explicitly.

Probably your best bet is to create a new Carbon app, confirm your code compiles in there, then examine the project file to compare it with yours to spot the difference. If you open the Build Results window and look at the build transcript, you should see what options gcc is being invoked with in the case which works vs the case which doesn't.
     
Thinine
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Sep 30, 2005, 12:22 PM
 
Hate to pull this thread off into a tangent, but why a Carbon app for your first Mac app? Cocoa would seem the way to go, especially with your Java background.

And make sure you have the latest Xcode Tools (2.1). They completely redid the build settings in that version.
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Sep 30, 2005, 02:23 PM
 
Woah, that was easy... Project -> Add -> (chose AppServices, Carbon, CoreServices) end voila! Works like a charm. I found this out by creating a Carbon project and seeing that it included those Frameworks by default. Thanks guys!

Thinine - Good question I went through the Cocoa/Xcode tutorial in Java and I totally get it; can't wait to get in there! But the code I need to incorporate into this product is an SDK from a device manufacturer, written in Carbon. And not just Carbon, but old school Carbon. This sample source is dated from like 2000 and didn't even come close to compiling out of the box. Grr...

Now to figure out why it can't find the drivers it's trying to load. One thing at a time!

Rob
     
Thinine
Mac Elite
Join Date: Jul 2002
Status: Offline
Reply With Quote
Sep 30, 2005, 04:16 PM
 
Makes sense then. I do caution you to stay away from Cocoa-Java though, as it's no longer actively developed. Learn Objective-C, it's not too different from Java.
     
rslifka  (op)
Forum Regular
Join Date: Dec 2004
Status: Offline
Reply With Quote
Sep 30, 2005, 04:55 PM
 
Gotcha. In the Cocoa-Java tutorial they point out that there are certain things you won't be able to do in Java, and suggest moving to Objective-C. The syntax is a little confusing so far, but hopefully I can overcome it. A matter of time and practive I suppose.

Thanks again for your help everyone,

Rob
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:56 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,