A.1. Compiling with the Win32 SDK

The code in Listing A.1 represents a typical console program named textsamp.cpp. The makefile in Listing A.2 will compile it under the SDK. Note that the makefile's first line reads "APP=textsamp." Change the name in this line to compile different programs.

Code Listing A.1. A simple console program (textsamp.cpp)
// textsamp.cpp


#include <windows.h>
#include <iostream.h>

void main(void)
{
  int x;
  
  for (x=0; x<10; x++)
  {
    cout < "Hello" < endl;
    Beep(100, 50);
    Sleep(250);
  }
}
Code Listing A.2. A makefile for Listing A.1 (textsamp.cpp). Run mstools\setenv. bat before trying to compile, and then type "nmake" to compile. Change the first line to compile a different file
 APP=textsamp NODEBUG=1 !include <ntwin32.mak> ...

Get Win32 System Services: The Heart of Windows® 98 and Windows® 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.