3.3.2 Borland C++ 4.x WINDOWS-programs

As under DOS, the #define __MINMAX_DEFINED statement is needed when <stdlib.h> is included. Use #define __USE_STL to compile your programs, when using <cstring.h> and <classlib\alloctr.h>. Don't forget to specify the STL-directory as include-directory under "options/project/directories" (german: "Optionen/Projekt/Verzeichnisse").

Example program:

#define __MINMAX_DEFINED        // use STL's generic min and max templates
#define __USE_STL               // exclude BC++'s redundant operator definitions

// STL include files - include STL files first!
#include "vector.h"

// C++ standard include files
#include <stdlib.h>             // stdlib min and max functions are skipped
#include <cstring.h>            // only compilable with __USE_STL directive
#include <classlib\alloctr.h>   // only compilable with __USE_STL directive

// OWL2 include files
#include <owl\owlpch.h>
#include <owl\applicat.h>

int OwlMain(int /*argc*/, char* /*argv*/ [])
  return TApplication("Compiled with STL include files").Run();

I encountered some problems when compiling windows programs that make extensive use of STL containers. The compiler comes up with the error messages "code segment exceeds 64k" and "text segment exceeds 64k". The problem can be fixed by using the statements #pragma codeseg <codeseg_name> code and #pragma codeseg <textseg_name> text, respectively.

Continue with section 3.3.3

Back to index

Johannes Weidl (J.Weidl@infosys.tuwien.ac.at) - Apr 16, 1996