Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / July 2006



Tip: Looking for answers? Try searching our database.

A two liner that won't compile on CW 9.5

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
François Robert - 05 Jul 2006 15:51 GMT
Dear NG

I need to add to a Photoshop plugin a function that takes an std::string
argument and creates a folder hierarchy using mkdir(). I am starting to
think this is not doable with CW 9.5 :

Config : I have CW 9.5 + Mac OSX Universal SDK 10.4

Issue : The following two lines will not compile :
#include <fstat.h>
#include <string>

with access paths set to
{Compiler}MSL/MSL_C (recursive)
{Compiler}MSL/MSL_C++ (recursive)
{Compiler}MSL/MSL_Extras/MSL_Common (recursive)
{OS X Volume}usr/include (not recursive)

Symptom : CW complains that identifier dev_t is redeclared (and gid_t
etc...)

I have exhausted all the combinations of access path order / #include
order etc : No matter what, some identifier is redefined or missing or
some include path is not found.

My question is thus:
What should be the target settings / #include order to compile those two
lines (which are merely a prerequisite for writing the function I need)
?

I believe that the problem is much deeper than it seems and that I am
unwittingly mixing MSL headers with BSD headers and that this is not
supported by CW (or at least only partially supported). However, I
cannot figure where this happens and how to avoid it.

Thanks for your help.
_______________________________________________________
François Robert
(to mail me, reverse character order in reply address)
David Phillip Oster - 05 Jul 2006 17:57 GMT
> Dear NG
>
[quoted text clipped - 30 lines]
> supported by CW (or at least only partially supported). However, I
> cannot figure where this happens and how to avoid it.

Checking /Developer/SDKs/MacOSX10.3.9.sdk and
/Developer/SDKs/MacOSX10.4u.sdk with:

find . -name "*stat.h" -print

shows that fstat isn't part of either SDK. Checking the MSL folder
inside the Codewarrior folder shows that it doesn't have an fstat.h
either.

Lastly, a check of /usr/include also fails to find an fstat.h

man fstat

shows that fstat wants:
#include <sys/types.h>
#include <sys/stat.h>

Adding those to a the HelloWorld.cp of a new "C++ console Mach-O" style
C++ project shows it compiles with no problems. (I've got

"OS X Volume" set to /Developer/SDKs/MacOSX10.3.9.sdk on the Source
Trees panel of the IDE preferences.

I also tried it with "OS X Volume" set to / in the project's
Preferences' Source Tree panel.

I can't make it fail!
François Robert - 06 Jul 2006 08:13 GMT
...
> fstat wants:
> #include <sys/types.h>
[quoted text clipped - 4 lines]
> (I've got "OS X Volume" set to /Developer/SDKs/MacOSX10.3.9.sdk
> on the Source Trees panel of the IDE preferences.)

My mistake(s) : The brain was thinking "stat" but the hand typed
"fstat"... I meant :
#include <stat.h>

But I think you pointed out the solution, too :
It should be (as documented) :
#include <sys/stat.h>

and not merely :
#include <stat.h>

and the access path should not contain the MSL_Extras part. That way, it
compiles (and run).

FYI : on my Mac I do have an MSL stat.h in
.../Metrowerks CodeWarrior/MSL/MSL_Extras/MSL_Common/Include/sys/stat.h

_______________________________________________________
François Robert
(to mail me, reverse character order in reply address)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.