How to check if an File/Directory Exists?
-
Hi,
I need to check if an File or Directory exists, but without the use of
Cocoa or ObjC.. I need it in plain C.. is there a way to do this? :)
And, I need a way to create a directory.. also in plain C.
Does anyone have an idea?
Aya
PS: I need it in plain C, cause I have to use GCC 3.3.. and it seems
like GCC3.3 can't compile ObjC.. I got many errors in the Cocoa.h :/ -
On Jan 1, 2008 4:53 PM, Aya Koshigaya <Aya...> wrote:>
> I need to check if an File or Directory exists, but without the use of
> Cocoa or ObjC.. I need it in plain C.. is there a way to do this? :)
stat(). See "man 2 stat"
And, I need a way to create a directory.. also in plain C.
mkdir(). See "man 2 mkdir"> PS: I need it in plain C, cause I have to use GCC 3.3.. and it seems
> like GCC3.3 can't compile ObjC.. I got many errors in the Cocoa.h :/
That's just plain wrong - GCC 3.3 is perfectly happy with Objective-C. Post
the errors you're seeing, and someone will probably be able to tell you what
the problem *really* is.
sherm-- -
Thanks,
here are the errors I get when compiling with GCC 3.3 (only the first
three):
/usr/include/objc/objc-auto.h:72: error: declaration of C function
`objc_object* objc_assign_ivar(objc_object*, objc_object*, int)'
conflicts with
/System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:62:
error: parse error before `__attribute__'
/System/Library/Frameworks/Foundation.framework/Headers/
NSPointerFunctions.h:59: error: parse error before `@' token
On Jan 1, 2008, at 23:25, Sherm Pendley wrote:> On Jan 1, 2008 4:53 PM, Aya Koshigaya <Aya...> wrote:
>
> I need to check if an File or Directory exists, but without the use of
> Cocoa or ObjC.. I need it in plain C.. is there a way to do this? :)
>
> stat(). See "man 2 stat"
>
> And, I need a way to create a directory.. also in plain C.
>
> mkdir(). See "man 2 mkdir"
>
> PS: I need it in plain C, cause I have to use GCC 3.3.. and it seems
> like GCC3.3 can't compile ObjC.. I got many errors in the Cocoa.h :/
>
> That's just plain wrong - GCC 3.3 is perfectly happy with Objective-
> C. Post the errors you're seeing, and someone will probably be able
> to tell you what the problem *really* is.
>
> sherm--
> -
On 1 Jan 2008, at 14:49, Aya Koshigaya wrote:> /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:
> 62: error: parse error before `__attribute__'
>
> /System/Library/Frameworks/Foundation.framework/Headers/
> NSPointerFunctions.h:59: error: parse error before `@' token
I wonder if you're trying to include a Cocoa header file in a C or C++
source code file? I've been recently doing some with in Objective-C++,
and you can't do that. But you can rename your source to end in .m
or .mm and you should be fine.
David Dunham A Sharp, LLC
Voice/Fax: 206 783 7404 http://a-sharp.com
Efficiency is intelligent laziness. -
Hi,
the file is allready an *.mm file.. :)
Aya
On Jan 2, 2008, at 00:00, David Dunham wrote:> On 1 Jan 2008, at 14:49, Aya Koshigaya wrote:
>
>> /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:
>> 62: error: parse error before `__attribute__'
>>
>> /System/Library/Frameworks/Foundation.framework/Headers/
>> NSPointerFunctions.h:59: error: parse error before `@' token
>
>
> I wonder if you're trying to include a Cocoa header file in a C or C+
> + source code file? I've been recently doing some with in Objective-C
> ++, and you can't do that. But you can rename your source to end
> in .m or .mm and you should be fine.
>
> David Dunham A Sharp, LLC
> Voice/Fax: 206 783 7404 http://a-sharp.com
> Efficiency is intelligent laziness.
>
> _______________________________________________
> MacOSX-dev mailing list
> <MacOSX-dev...>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev -
On Jan 1, 2008 5:49 PM, Aya Koshigaya <Aya...> wrote:> Thanks,
>
> here are the errors I get when compiling with GCC 3.3 (only the first
> three):
>
> /usr/include/objc/objc-auto.h:72: error: declaration of C function
> `objc_object* objc_assign_ivar(objc_object*, objc_object*, int)'
> conflicts with
>
> /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:62:
> error: parse error before `__attribute__'
You're trying to use the old compiler with a recent (10.4u or 10.5) SDK. If
you want to compile for 10.4 or 10.5, use GCC 4. If you want to use GCC 3.3,
use the 10.3.9 SDK.
sherm-- -
On Jan 1, 2008 6:02 PM, Aya Koshigaya <Aya...> wrote:> Hi,
>
> the file is allready an *.mm file.. :)
GCC 3.3 is only required if your C++ or Objective-C++ app must run on
10.3.8or older OS releases. Apps built with GCC 4 will work with
10.3.9 or newer.
How many people are still running Jaguar, or Panther without Software
Update? I'm guessing we could count them without overflowing a signed char.
sherm-- -
Ahh, ok thanks :)
I now encountered a new problem.. (hopefully the last one)
I tried to compile a plugin on my Intel-Mac for an old PPC-Mac.. when
I load the plugin, I get this error message:
PID: 2502
Thread: Unknown
Link (dyld) error:
Symbol not found: _fcntl$UNIX2003
Referenced from: /Users/Shared/Alias/maya/plug-ins/test.lib
Expected in: /usr/lib/libSystem.B.dylib
What can I do here? :/
Aya
On Jan 2, 2008, at 00:20, Sherm Pendley wrote:> On Jan 1, 2008 5:49 PM, Aya Koshigaya <Aya...> wrote:
> Thanks,
>
> here are the errors I get when compiling with GCC 3.3 (only the first
> three):
>
> /usr/include/objc/objc-auto.h:72: error: declaration of C function
> `objc_object* objc_assign_ivar(objc_object*, objc_object*, int)'
> conflicts with
>
> /System/Library/Frameworks/Foundation.framework/Headers/NSArray.h:62:
> error: parse error before `__attribute__'
>
> You're trying to use the old compiler with a recent ( 10.4u or 10.5)
> SDK. If you want to compile for 10.4 or 10.5, use GCC 4. If you want
> to use GCC 3.3, use the 10.3.9 SDK.
>
> sherm--
> -
On Jan 1, 2008 6:30 PM, Aya Koshigaya <Aya...> wrote:> Ahh, ok thanks :)
>
> I now encountered a new problem.. (hopefully the last one)
> I tried to compile a plugin on my Intel-Mac for an old PPC-Mac.. when
> I load the plugin, I get this error message:
>
> PID: 2502
> Thread: Unknown
>
> Link (dyld) error:
>
> Symbol not found: _fcntl$UNIX2003
> Referenced from: /Users/Shared/Alias/maya/plug-ins/test.lib
> Expected in: /usr/lib/libSystem.B.dylib
>
> What can I do here? :/
What version of Maya are you using? The Autodesk site says that the latest
version - 2008 Complete - requires 10.4.8, and there's a plugin project
template here<http://highend3d.com/maya/downloads/plugins/interface_display/Maya-8-5-API-
Template-for-Xcode-4910.html>that
uses Xcode
2.2 and GCC 4 to build plugins for 8.5.
I don't have a copy of Maya to test - it's out of my price range - but what
I would do is make sure to use GCC 4 and the 10.4u SDK. You might also want
to download the template project above, see if it builds and runs a "hello
world" plugin cleanly, and if it does check its compiler & SDK versions
against those of your own project.
sherm--


