Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

#import questions with Cocoa/Cocoa.h and SMySql/SMySql.h

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  CALL_ON_LOAD, CALL_ON_MODULE_BIND, etc.  
Author Message
Van Bagnol

External


Since: Feb 01, 2004
Posts: 72



(Msg. 1) Posted: Tue Sep 28, 2004 12:02 am
Post subject: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h
Archived from groups: comp>sys>mac>programmer>help (more info?)

I am still new to Xcode, having come from using CodeWarrior, and am
building the CocoaMySQL application from the source to get my feet wet.
I'm a little unfamiliar with the layout of the new IDE.

The build command in the project file is telling me it can't find the
file imported by "#import <SMySQL/SMySQL.h>" -- however, it _is_ able to
find "#import <Cocoa/Cocoa.h>". As far as I can tell, both files can be
found and viewed in the project, yet neither file is, technically, in
the subdirectory specified in the #import directive. E.g., I do have a
file named Cocoa.h which Xcode can display in its edit pane, but it's
not in any subdirectory named Cocoa, but rather resides in:
"/System/Library/Frameworks/Cocoa.framework/Versions/A/Headers/".
Similarly, I have a file named SMySQL.h but it's not in a subdirectory
named SMySQL but rather in "~/Development/CocoaMySQL source/
SMySQL.framework/Versions/A/Headers/".

What I don't understand is why Xcode's #import directive can find one of
the .h files but not the other. What's the deal with #imported filenames
that contain slashes, and are they literally subdirectories or are they
package/frameworks, and what's the convention for them? Where in the IDE
can I set the search path for included files and system included files?

Van
--
Van Bagnol / n p c o m p l e t e at bagnol dot com / c r l at bagnol dot com
....enjoys Theatre / Windsurfing / Skydiving / Mountain Biking
....feels "parang lumalakad ako soo loob ng panaginip"
....thinks "An Error is Not a Mistake ... Unless You Refuse to Correct It"
Back to top
Login to vote
Sherm Pendley

External


Since: Jul 23, 2007
Posts: 221



(Msg. 2) Posted: Tue Sep 28, 2004 12:02 am
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Van Bagnol wrote:

> What I don't understand is why Xcode's #import directive can find one of
> the .h files but not the other. What's the deal with #imported filenames
> that contain slashes, and are they literally subdirectories or are they
> package/frameworks, and what's the convention for them?

They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
the part before the slash - is the name of the framework without the
extension, and the second part tells it what file to look for in that
framework's Headers/ subdirectory.

> Where in the IDE
> can I set the search path for included files and system included files?

That's probably not what you want to do here.

Just add the CocoaMySQL framework to your project. Choose the
"Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
directory, *not* the individual files inside that directory. That will
not only add the framework's Headers/ subdir to the preprocessor search
path, it will also link the dynamic library that's in the framework to
your app.

(If memory serves, older versions - I'm using Xcode 1.5 - had a slightly
different layout for the "Project" menu, with separate "Add framework
...." and "Add files ..." items. Same idea though... you want to add the
framework to your project as a unit, not the individual files inside of it.)

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Back to top
Login to vote
Frédéric Testuz

External


Since: Sep 28, 2004
Posts: 1



(Msg. 3) Posted: Tue Sep 28, 2004 2:42 am
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Sherm Pendley" <spamtrap DeleteThis @dot-app.org> a écrit dans le message de
news:7IqdnRWO8894asXcRVn-rA@adelphia.com...
> Van Bagnol wrote:
>
> > What I don't understand is why Xcode's #import directive can find one of
> > the .h files but not the other. What's the deal with #imported filenames
> > that contain slashes, and are they literally subdirectories or are they
> > package/frameworks, and what's the convention for them?
>
> They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
> the part before the slash - is the name of the framework without the
> extension, and the second part tells it what file to look for in that
> framework's Headers/ subdirectory.
>
> > Where in the IDE
> > can I set the search path for included files and system included files?
>
> That's probably not what you want to do here.
>
> Just add the CocoaMySQL framework to your project. Choose the
> "Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
> directory, *not* the individual files inside that directory. That will
> not only add the framework's Headers/ subdir to the preprocessor search
> path, it will also link the dynamic library that's in the framework to
> your app.
>
> (If memory serves, older versions - I'm using Xcode 1.5 - had a slightly
> different layout for the "Project" menu, with separate "Add framework
> ..." and "Add files ..." items. Same idea though... you want to add the
> framework to your project as a unit, not the individual files inside of
it.)

I want just add that depend on which version of SMySQL (dynamic, static,
....) you take perhaps you will have to change either the #import
<SMySQL/SMyQL.h> to #import <SMySQL_bundled/SMySQL.h> or edit the name of
the file. At least it was the case for the last time I used CocoaMySQL.

--
Frédéric Testuz
Back to top
Login to vote
Van Bagnol

External


Since: Feb 01, 2004
Posts: 72



(Msg. 4) Posted: Tue Sep 28, 2004 9:53 am
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <7IqdnRWO8894asXcRVn-rA DeleteThis @adelphia.com>,
Sherm Pendley <spamtrap DeleteThis @dot-app.org> wrote:

> Van Bagnol wrote:
>
> > What I don't understand is why Xcode's #import directive can find one of
> > the .h files but not the other. What's the deal with #imported filenames
> > that contain slashes, and are they literally subdirectories or are they
> > package/frameworks, and what's the convention for them?
>
> They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
> the part before the slash - is the name of the framework without the
> extension, and the second part tells it what file to look for in that
> framework's Headers/ subdirectory.
[...]
> Just add the CocoaMySQL framework to your project. Choose the
> "Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
> directory, *not* the individual files inside that directory. That will
> not only add the framework's Headers/ subdir to the preprocessor search
> path, it will also link the dynamic library that's in the framework to
> your app.

That's what's puzzling. In my project, in the folder marked
"CocoaMySQL->Frameworks->Linked Frameworks" of the "Groups & Files"
pane, both Cocoa.framework and SMySQL.framework are included. I can
clearly see both
"...Frameworks->Linked Frameworks->Cocoa.framework->Headers->Cocoa.h"
and
"...Frameworks->Linked Frameworks->SMySQL.framework->Headers->SMySQL.h"
listed in the pane. Clicking either one of the files displays the source
code in the .h file. Yet when I tried to compile a module containing
#import <Cocoa/Cocoa.h>
#import <SMySQL/SMySQL.h>
The compiler/preprocessor accepts the first #import but not the second.
Changing the line to
#import "SMySQL/SMySQL.h"
doesn't seem to make a difference.

I'm guessing that the only thing different is a search path somewhere
letting the compiler find the Cocoa framework in /System/Library but not
the SMySQL framework in ~/Development/..../<myproject>, despite the IDE
being able to find both files.

BTW, this is the exact set of project files unstuffed from the
CocoaMySQL source code download, so would think all the project
components are complete and in their correct relative locations.

Van
--
Van Bagnol / n p c o m p l e t e at bagnol dot com / c r l at bagnol dot com
....enjoys Theatre / Windsurfing / Skydiving / Mountain Biking
....feels "parang lumalakad ako soo loob ng panaginip"
....thinks "An Error is Not a Mistake ... Unless You Refuse to Correct It"
Back to top
Login to vote
Glenn Andreas

External


Since: Mar 19, 2004
Posts: 30



(Msg. 5) Posted: Tue Sep 28, 2004 9:53 am
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <van-CF9F1C.07534328092004 DeleteThis @news2.west.earthlink.net>,
Van Bagnol <van DeleteThis @crl.com.invalid> wrote:

> In article <7IqdnRWO8894asXcRVn-rA DeleteThis @adelphia.com>,
> Sherm Pendley <spamtrap DeleteThis @dot-app.org> wrote:
>
> > Van Bagnol wrote:
> >
> > > What I don't understand is why Xcode's #import directive can find one of
> > > the .h files but not the other. What's the deal with #imported filenames
> > > that contain slashes, and are they literally subdirectories or are they
> > > package/frameworks, and what's the convention for them?
> >
> > They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
> > the part before the slash - is the name of the framework without the
> > extension, and the second part tells it what file to look for in that
> > framework's Headers/ subdirectory.
> [...]
> > Just add the CocoaMySQL framework to your project. Choose the
> > "Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
> > directory, *not* the individual files inside that directory. That will
> > not only add the framework's Headers/ subdir to the preprocessor search
> > path, it will also link the dynamic library that's in the framework to
> > your app.
>
> That's what's puzzling. In my project, in the folder marked
> "CocoaMySQL->Frameworks->Linked Frameworks" of the "Groups & Files"
> pane, both Cocoa.framework and SMySQL.framework are included. I can
> clearly see both
> "...Frameworks->Linked Frameworks->Cocoa.framework->Headers->Cocoa.h"
> and
> "...Frameworks->Linked Frameworks->SMySQL.framework->Headers->SMySQL.h"
> listed in the pane. Clicking either one of the files displays the source
> code in the .h file. Yet when I tried to compile a module containing
> #import <Cocoa/Cocoa.h>
> #import <SMySQL/SMySQL.h>
> The compiler/preprocessor accepts the first #import but not the second.
> Changing the line to
> #import "SMySQL/SMySQL.h"
> doesn't seem to make a difference.
>
> I'm guessing that the only thing different is a search path somewhere
> letting the compiler find the Cocoa framework in /System/Library but not
> the SMySQL framework in ~/Development/..../<myproject>, despite the IDE
> being able to find both files.
>
> BTW, this is the exact set of project files unstuffed from the
> CocoaMySQL source code download, so would think all the project
> components are complete and in their correct relative locations.


When you "add library" it doesn't update the include search path (and,
in fact, if you've installed OS SDK support, it actually looks in
/Developer/(where ever the OS SDK live) rather than /System/Library for
frameworks as well).

Normally, libraries live somewhere that the default include search path
already covers, so there is no problem, but since you're using one that
isn't, you'll need to manually update it (somewhere in the build
settings panel).
Back to top
Login to vote
Van Bagnol

External


Since: Feb 01, 2004
Posts: 72



(Msg. 6) Posted: Tue Sep 28, 2004 6:14 pm
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySQL/SMySQL.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <gandreas-F8BF54.11551128092004.RemoveThis@news.visi.com>,
Glenn Andreas <gandreas.RemoveThis@no.reply> wrote:

> In article <van-CF9F1C.07534328092004.RemoveThis@news2.west.earthlink.net>,
> Van Bagnol <van.RemoveThis@crl.com.invalid> wrote:
>
> > In article <7IqdnRWO8894asXcRVn-rA.RemoveThis@adelphia.com>,
> > Sherm Pendley <spamtrap.RemoveThis@dot-app.org> wrote:
> >
> > > Van Bagnol wrote:
> > >
> > > > What I don't understand is why Xcode's #import directive can
> > > > find one of the .h files but not the other. What's the deal
> > > > with #imported filenames that contain slashes, and are they
> > > > literally subdirectories or are they package/frameworks, and
> > > > what's the convention for them?
> > >
> > > They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
> > > the part before the slash - is the name of the framework without the
> > > extension, and the second part tells it what file to look for in that
> > > framework's Headers/ subdirectory.
> > [...]
> > > Just add the CocoaMySQL framework to your project. Choose the
> > > "Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
> > > directory, *not* the individual files inside that directory.
[snip]
> >
> > That's what's puzzling. In my project, in the folder marked
> > "CocoaMySQL->Frameworks->Linked Frameworks" of the "Groups & Files"
> > pane, both Cocoa.framework and SMySQL.framework are included. I can
> > clearly see both
> > "...Frameworks->Linked Frameworks->Cocoa.framework->Headers->Cocoa.h"
> > and
> > "...Frameworks->Linked Frameworks->SMySQL.framework->Headers->SMySQL.h"
[snip]
> > I'm guessing that the only thing different is a search path somewhere
> > letting the compiler find the Cocoa framework in /System/Library but not
> > the SMySQL framework in ~/Development/..../<myproject>, despite the IDE
> > being able to find both files.
> >
> > BTW, this is the exact set of project files unstuffed from the
> > CocoaMySQL source code download, so would think all the project
> > components are complete and in their correct relative locations.
>
> When you "add library" it doesn't update the include search path (and,
> in fact, if you've installed OS SDK support, it actually looks in
> /Developer/(where ever the OS SDK live) rather than /System/Library for
> frameworks as well).
>
> Normally, libraries live somewhere that the default include search path
> already covers, so there is no problem, but since you're using one that
> isn't, you'll need to manually update it (somewhere in the build
> settings panel).

Well, I manually added the SMySQL.framework to the project (so now
there's two of them) which finally got the app to compile, build (albeit
with some duplicate symbol warnings), and run.

However, it's warning me that certain directories don't exist, e.g.,
/Users/ide/developer (apparently from the original uploaded
configuration). I can't seem to find where those directories are
specified. I do seem to remember a instance when I was able to examine
the project's plists (I recall seeing the names of those nonexistent
directories listed somewhere) but I can't figure how to get back to it
again.

Van
--
Van Bagnol / n p c o m p l e t e at bagnol dot com / c r l at bagnol dot com
....enjoys Theatre / Windsurfing / Skydiving / Mountain Biking
....feels "parang lumalakad ako soo loob ng panaginip"
....thinks "An Error is Not a Mistake ... Unless You Refuse to Correct It"
Back to top
Login to vote
Heath Raftery

External


Since: Jul 10, 2003
Posts: 297



(Msg. 7) Posted: Tue Sep 28, 2004 7:22 pm
Post subject: Re: #import questions with Cocoa/Cocoa.h and SMySql/SMySql.h [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Van Bagnol <van RemoveThis @crl.com.invalid> wrote:
> In article <7IqdnRWO8894asXcRVn-rA RemoveThis @adelphia.com>,
> Sherm Pendley <spamtrap RemoveThis @dot-app.org> wrote:

>> Van Bagnol wrote:
>>
>> > What I don't understand is why Xcode's #import directive can find one of
>> > the .h files but not the other. What's the deal with #imported filenames
>> > that contain slashes, and are they literally subdirectories or are they
>> > package/frameworks, and what's the convention for them?
>>
>> They're frameworks. The first part of "#import <Cocoa/Cocoa.h>" - i.e.
>> the part before the slash - is the name of the framework without the
>> extension, and the second part tells it what file to look for in that
>> framework's Headers/ subdirectory.
> [...]
>> Just add the CocoaMySQL framework to your project. Choose the
>> "Project/Add to Project ..." menu item, and add the CocoaMySQL.framework
>> directory, *not* the individual files inside that directory. That will
>> not only add the framework's Headers/ subdir to the preprocessor search
>> path, it will also link the dynamic library that's in the framework to
>> your app.

> That's what's puzzling. In my project, in the folder marked
> "CocoaMySQL->Frameworks->Linked Frameworks" of the "Groups & Files"
> pane, both Cocoa.framework and SMySQL.framework are included. I can
> clearly see both
> "...Frameworks->Linked Frameworks->Cocoa.framework->Headers->Cocoa.h"
> and
> "...Frameworks->Linked Frameworks->SMySQL.framework->Headers->SMySQL.h"
> listed in the pane. Clicking either one of the files displays the source
> code in the .h file. Yet when I tried to compile a module containing
> #import <Cocoa/Cocoa.h>
> #import <SMySQL/SMySQL.h>
> The compiler/preprocessor accepts the first #import but not the second.
> Changing the line to
> #import "SMySQL/SMySQL.h"
> doesn't seem to make a difference.

> I'm guessing that the only thing different is a search path somewhere
> letting the compiler find the Cocoa framework in /System/Library but not
> the SMySQL framework in ~/Development/..../<myproject>, despite the IDE
> being able to find both files.

This was mostly answered elsewhere, but I did want to reiterate a possible
source of frustration. I had almost the same problem as you over the last
couple of days, except the preprocessor was happy with
#import <Security/Authorization.h>
but not
#import <Security/AuthorizationDB.h>
#import <SecurityInterface/SFAuthorizationView.h>
the latter of which was the one I was actually after. This was despite the
fact that I had added all the frameworks, and could clearly see the
headers listed under the frameworks. In a moment of sudden clarity, I
realised this was because I was targetting the OS X 10.2.8 SDK, and the
headers I was after did not exist under
/Developer/SDKs/MacOSX10.2.8/System/Library/Frameworks/

So just a word of warning to all, which I hope saves someone some time -
make sure the frameworks you add are available in the OS you are
targetting!
--
*--------------------------------------------------------*
| ^Nothing is foolproof to a sufficiently talented fool^ |
| Heath Raftery, HRSoftWorks _\|/_ |
*______________________________________m_('.')_m_________*
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[COCOA]have you ever seen this? - i wrote an application in cocoa-java(thank you for your help in my last thread)...it compiles without errors, but when...

AppleScript and Cocoa - This is driving me nuts! I have a fairly simple obj-c dialog based app and I want to make it scriptable. So far I have...

Considering Cocoa Books - I'm not doing well with the existing documentation that comes with Xcode. I've also found the currency converter app t...

Localization in Cocoa - I've dealt with the localization aspects of cocoa, and bundles for a while now, and am wondering how other people are d...

DragGrayRgn for Cocoa? - Is there any equivalent to DragGrayRgn for Cocoa - ie something where the user can drag the mouse and a rectangle will ...

Cocoa Browser Help - Anybody else here using Hoshi Takanori's Cocoa Browser as a documentation tool. I'm hoping someone can explain why it ...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]