Problem with segment size

Hello,
I’ve got a piece of code that compiles fine. After I’ve added a couple
of
includes it still works. When I try to add a (global of local) variable
in
one particular cpp-file the compiler responds with the message 094 :
“***
Fatal *** segment too large” somewhere in a stl-header file.

If I remove the variable or comment out an arbitrary piece of code, the
code compiles again. It looks as if both the code and data-segment are
too
small, but that’s quite strange because we’re working with a 32-bit 4Gb
(small) memory model.

I have tried cleaning up the include files (replacing includes with
forward
declarations) but that only resulted in the same error in another
(non-stl)
include file.

(Oddly enough, when the code is compiled with the -ml option the
compiler
doesn’t generate the error, although the -ml model is not defined in the
32
bit model).

I realize that the description above is a bit cryptic, but if somebody
could
at least give me a clue what might be wrong, I would appreciate it.

Thanks,

Marius.

Marius Cecon <a24@schoenenberger.de> wrote:

I’ve got a piece of code that compiles fine. After I’ve added a couple
of
includes it still works. When I try to add a (global of local) variable
in
one particular cpp-file the compiler responds with the message 094 :
“***
Fatal *** segment too large” somewhere in a stl-header file.

Likely you are running into an issue with debug information. The
Watcom debug information is still sectioned, in a few places, into
64k segments.

There are a couple of choices – you can subdivide the file. This
may not make logical sense, or may cause other problems – so may not
be the best solution.

You could reduce the level of debug information – you are more likely
to run into this problem at -g2 than at -g1.

You can switch to Dwarf format debug information – it doesn’t have the
64k boundaries. You would pass -g2d on the cc line, rather than -g2.
But, all objects linked into your application must have the same format
of debug information, so this would mean recompiling and source files for
this project. I also seem to remember that there were some problems with
using Dwarf format debug information with C++ code – I don’t remember the
specifics, but I think it might have been something to do with viewing or
getting type information for global variables.

Hope this helps.

-David

QNX Training Services
dagibbs@qnx.com