STL, CW 8.3 and MacOSX 10.2.6

STL, CW 8.3 and MacOSX 10.2.6

Post by Howard Hin » Thu, 07 Aug 2003 01:28:26

In article <bgocen$ruh$ XXXX@XXXXX.COM >, 0182

| ... hi all,
| for the first time of my life I am trying to develop an application on X
| but, unfortunately, I have a problem I cannot manage and, may be, someone of
| you can point me out to the right direction.
| I have an old application originally written for MacOS using also the C++
| STL.
| If I try to use the same code on MacOSX I always get an "access fault
| exception" when I try to instance an STL object.
| Just a simple example: if I include the <fstream> header and use an ofstream
| object, during the startup, I always get an "access fault exception" in the
| the initialization of the STL fstream library.
| Any hint?

This works for me under both PEF and Mach-O:

#include <fstream>

int main()
std::ofstream out("test.dat");
out << "Hi";

Does it work for you? If so, can you give us a demo of what is not


Howard Hinnant

STL, CW 8.3 and MacOSX 10.2.6

Post by MW Ro » Thu, 07 Aug 2003 02:54:25

In article <bgocen$ruh$ XXXX@XXXXX.COM >,

I need to know a lot more. Is this a simple console application or is
this a GUI application.

Are you using MSL what code are you using to open your file. Is this a
global stream you are opening. When you say STL are you using an
Auxillary STL library instead of the Standard C++ Library (MSL) there
would be lots of conflicts in headers if that was the case.

More information would be useful, but one thing to try is in the MSL C++
Refernece are some examples for using streams see if they work and build
for you.


CodeWarrior Development Studio for Macintosh v9
Enhance Your Productivity and Shorten your Development Cycles
< ;
Sales and Support 512-996-5300 800-377-5416
Ron Liechty - XXXX@XXXXX.COM -


STL, CW 8.3 and MacOSX 10.2.6

Post by Miro Juris » Thu, 07 Aug 2003 13:06:32

In article <bgocen$ruh$ XXXX@XXXXX.COM >, "0182" < XXXX@XXXXX.COM >

You probably #defined MSL_NO_LOCALE in your prefix file. Take that out and



STL, CW 8.3 and MacOSX 10.2.6

Post by 0182 » Fri, 08 Aug 2003 01:57:58

... BINGO!!!


Trying to compile the project on MacOS X I changed the order of the header
files and I had a #define _MSL_NO_LOCALE
just before the MSL C++ headers.

Thanks to everybody for your replies and a GREAT THANK to Miro for your

-- Stefano