www.digitalmars.com         C & C++   DMDScript  

c++.dos - HOWTO: compiling for DOS

reply um <um4711 mutluit.com> writes:
Hello,
my envirnment is XP, but I need to compile for DOS.
When I try to compile the TSRCLOCK.c sample from dm-site then I get the errors
below.
The DOS libs and tools are copied to the correct directories;
it looks like the target (DOS) is not well specified.
I also tried -msdw but that too brings the same error.
What is the correct dmc compile option for DOS (tiny or small mem model)?

dmc -mti TSRCLOCK.c
  intdos( s,  s);
         ^
TSRCLOCK.c(85) : Lexical error: unrecognized token
  int86(0x10, s, s);
             ^
TSRCLOCK.c(107) : Lexical error: unrecognized token
  int86(0x10,  s, s);
              ^
TSRCLOCK.c(110) : Lexical error: unrecognized token
  int86(0x10, s, s);
             ^
TSRCLOCK.c(117) : Lexical error: unrecognized token
  int86(0x10, s, s);
             ^
TSRCLOCK.c(125) : Lexical error: unrecognized token
Fatal error: too many errors
--- errorlevel 1
Apr 03 2013
parent Heinz Saathoff <newshsaat arcor.de> writes:
Hello,

I haven't had a look on the dm-site and the example DOS-code.
I assume there is some header file missing.
Here is a example that I can compile:
 
//--------- e.cpp -----------------
#include <dos.h>

int main(int argc, char*argv[])
{  union REGS rin, rout;
   intdos( &rin,  &rout);
   int86(0x10, &rin, &rout);
   return 0;
}//main
//---------------------------------

Compile and compiler output:
  D:\TEMP>dmc -mti e.cpp
  link ct+e,e/noi;
  OPTLINK (R) for Win32  Release 8.00.5
  Copyright (C) Digital Mars 1989-2009  All rights reserved.
  http://www.digitalmars.com/ctg/optlink.html
  OPTLINK : Warning 23: No Stack
  
  EXE2BIN e.exe e.com

Don't execute the resulting program as the register union rin
is not initialized!


- Heinz


um wrote...
 Hello,
 my envirnment is XP, but I need to compile for DOS.
 When I try to compile the TSRCLOCK.c sample from dm-site then I get the errors
below.
 The DOS libs and tools are copied to the correct directories;
 it looks like the target (DOS) is not well specified.
 I also tried -msdw but that too brings the same error.
 What is the correct dmc compile option for DOS (tiny or small mem model)?
 
 dmc -mti TSRCLOCK.c
   intdos( s,  s);
          ^
 TSRCLOCK.c(85) : Lexical error: unrecognized token
   int86(0x10, s, s);
              ^
 TSRCLOCK.c(107) : Lexical error: unrecognized token
   int86(0x10,  s, s);
Apr 09 2013