|
Next: Looking for Mac Classic Compilers
|
| Author |
Message |
External

Since: Apr 11, 2006 Posts: 5
|
(Msg. 1) Posted: Mon May 08, 2006 2:40 am
Post subject: no chdir() in mach-o build of CW9?!? Archived from groups: comp>sys>mac>programmer>codewarrior (more info?)
|
|
|
Hi all,
I've a little problem with CW9: if i start a mach-o standard C
project, there seems to be no chdir() function!!! The function is
defined and implemented in classic and carbon libraries, but it's no
more present in the mach-o ones! Is there a workaround for it? Is there
a way to change the current working directory with some CF
object/function?... I need to change the working dir to the one that
contains the application, so that I can use fopen() with relative
paths...
Thanx in advance to everyone so kind to answer me!... |
|
| Back to top |
|
 |  |
External

Since: Apr 11, 2006 Posts: 5
|
(Msg. 2) Posted: Mon May 08, 2006 7:49 am
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
|
| yes, I did of course, but the problem is that chdir() is not even
defined in unistd.h! There are some conditional macros that define it
only for classic or carbon builds, but not for mach-o! And in the
standard project libraries, there is no implementation for chdir() in
the MSL All Mach-o, only for the standard fopen(), fclose() etc... 
|
|
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2005 Posts: 150
|
(Msg. 3) Posted: Mon May 08, 2006 2:00 pm
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1147081237.841706.271070 RemoveThis @e56g2000cwe.googlegroups.com>,
"ultimatewarrior" <ultimatecodewarrior RemoveThis @yahoo.it> wrote:
> I've a little problem with CW9: if i start a mach-o standard C
> project, there seems to be no chdir() function!!! The function is
> defined and implemented in classic and carbon libraries, but it's no
> more present in the mach-o ones! Is there a workaround for it? Is there
> a way to change the current working directory with some CF
> object/function?... I need to change the working dir to the one that
> contains the application, so that I can use fopen() with relative
> paths...
Have you dragged /System/Library/Frameworks/System.framework from the
Finder to the Frameworks tab?
Have you added the line:
#include <unistd.h>
to include the appropriate header file? |
|
| Back to top |
|
 |  |
External

Since: Apr 11, 2006 Posts: 5
|
(Msg. 4) Posted: Tue May 09, 2006 12:51 am
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Ok, but how can I get to /usr/include/unistd.h? CW9 in a standard C
Mach-o stationery project places its access paths (MSL, MacOS X Support
etc.) BEFORE usr/include, so if I #include unistd.h I get MW's one, not
/usr/include/unistd.h - and if I change the order of the access paths
so that unix ones are before MW's, I get an error from CW9 complaining
about the fact that its access paths are after unix ones! And, anyway,
the problem remains, because even if I can get the definition of
chdir(), still I can't find the implementation... |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2005 Posts: 150
|
(Msg. 5) Posted: Tue May 09, 2006 1:20 am
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1147099785.902973.208900 DeleteThis @v46g2000cwv.googlegroups.com>,
"ultimatewarrior" <ultimatecodewarrior DeleteThis @yahoo.it> wrote:
> yes, I did of course, but the problem is that chdir() is not even
> defined in unistd.h! There are some conditional macros that define it
> only for classic or carbon builds, but not for mach-o! And in the
> standard project libraries, there is no implementation for chdir() in
> the MSL All Mach-o, only for the standard fopen(), fclose() etc...
You are looking in the wrong one. /usr/include/unistd.h has no such
problem. Check your access paths. |
|
| Back to top |
|
 |  |
External

Since: Apr 11, 2006 Posts: 5
|
(Msg. 6) Posted: Tue May 09, 2006 9:20 am
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
SOLVED!
Thank you for your aid, but I solved the problem in a really
"quick-and-dirt" way by simply declaring the chdir() prototype as it
appears in the unix unistd.h file. It worked. I dunno why I still
cannot get to the unistd.h file in usr/include, however the workaround
is just ok for my needs...
Thanx very much for your help! |
|
| Back to top |
|
 |  |
External

Since: Jul 21, 2005 Posts: 150
|
(Msg. 7) Posted: Tue May 09, 2006 2:02 pm
Post subject: Re: no chdir() in mach-o build of CW9?!? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
In article <1147161067.415553.127040 DeleteThis @j33g2000cwa.googlegroups.com>,
"ultimatewarrior" <ultimatecodewarrior DeleteThis @yahoo.it> wrote:
> Ok, but how can I get to /usr/include/unistd.h? CW9 in a standard C
> Mach-o stationery project places its access paths (MSL, MacOS X Support
> etc.) BEFORE usr/include, so if I #include unistd.h I get MW's one, not
> /usr/include/unistd.h - and if I change the order of the access paths
> so that unix ones are before MW's, I get an error from CW9 complaining
> about the fact that its access paths are after unix ones! And, anyway,
> the problem remains, because even if I can get the definition of
> chdir(), still I can't find the implementation...
I just tried it, and could not reproduce your problem.
I used CW9 to create a "C Toolbox Mach-o" variant of a standard C Mach-o
stationery project. I didn't need to touch the access paths. I didn't
need to add any frameworks.
The program:
#include <Carbon/Carbon.h>
#include <unistd.h>
int main(void){
InitCursor();
chdir("/");
return 0;
}
compiled and linked with no problems. Option clicking on the call the
chdir showed that it was declared in the correct unistd.h
One difference between you and me:
Using the "Preferences" menu command, under the Codewarrior menu, in the
Source Trees panel, I'd added the line:
Name Path
OS X Volume /Developer/SDKs/MacOSX10.3.9.sdk
And of course I do have that SDK installed from Xcode.
I hope this helps. |
|
| Back to top |
|
 |  |
| Related Topics: | CW 10 building larger Mach-O binary - I'm just curious, but my Mach-O binary is about 400K (about 9%) larger when built with CW 10 than when built with CW 9, both with optimizations off. Any ideas why that would be? Thanks, Larry
Mach-O dynamic library init/term functions? - I have a CFM shared library that I'm converting to Mach-O, currently in CW 9.6, and soon to be in XCode 2.x as well. One thing that I haven't figured out is how to specify initialization/termination functions for the Mach-O version of the library..
[CW7] odd build errors in math lib when C++ enabled - This question appears to have been asked before but no satisfactory answer was turned up by Google. I have enabled C++ on a Carbon project (using MacCarbonHeaders) and am finding compilation aborts with a large number of errors of the form: Error :..
Bug in alloc.c? - I'm getting an infinite loop in alloc.c, which is located in MSL/MSL_C/MSL_Common/Src. This is with CW 9.5. The function is allocate_from_var_pools. There is a do/while loop that searches for a block with the required size to allocate a block of..
Multiply defined symbol: .bss - Hi, when trying to build a dll for Windows using CW9 on MacOS, I get an error message like: Link Error : Multiply defined symbol: .bss in files file1.cpp, file2.cpp The same message with the same filenames is repeated several times, but.... |
|
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
|
|
|
|