29 December 2015

wcc386

System: Microsoft Windows XP Home Edition
CPUs: Intel(R) Atom(TM) CPU N270 @1.60GHz

Updated 8 Nov. 2016

I received a notice today as a reminder that Open Watcom's C++
implementation is not standards conforming; see the links at the
base of this blog entry.

Installation of awk on Open Watcom C version 1.9.

https://www.cs.princeton.edu/~bwk/btl.mirror/new/

Version 1.9
https://sourceforge.net/projects/openwatcom/files/open-watcom-1.9/
open-watcom-c-win32-1.9.exe

http://openwatcom.mirror.fr/source/
open_watcom_1.9.0-src.zip

Download both the OW .exe and .zip files, installing the former and extracting the latter.

We will compile yacc and awk, neither of which accompany the binary download.

Run the batch file owsetenv.bat for the binary installation.

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\UserName>CD \

C:\>Programmer\WATCOM\owsetenv.bat
Open Watcom Build Environment

C:\>

CD into OW19 and edit the file setvars.bat as follows:

SET OWROOT=C:\OW19
SET WATCOM=C:\Programmer\WATCOM
SET DOC_BUILD=0

C:\>CD OW19

C:\OW19>setvars.bat
Open Watcom compiler build environment

C:\OW19\bld>CD yacc\nt386

C:\OW19\bld\yacc\nt386>wmake
Open Watcom Make Version 1.9
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
cc bitsets.obj
cc buildpro.obj
cc default.obj
cc defshift.obj
cc dont_opt.obj
cc elimunit.obj
cc fpopen.obj
cc genfast.obj
cc gensupp.obj
cc gentable.obj
cc getname.obj
cc lalr1.obj
cc lr0.obj
cc parse.obj
cc sentence.obj
cc used.obj
cc yacc.obj
cl yacc.exe

C:\OW19\bld\yacc\nt386>COPY yacc.exe %WATCOM%\binnt
        1 fil(er) kopieret.

C:\OW19\bld\yacc\nt386>CD %OWROOT%\contrib

C:\OW19\contrib>MOVE awk %WATCOM%\src

C:\OW19\contrib>CD %WATCOM%\src\awk

C:\Programmer\WATCOM\src\awk>nmake -f makefile.win
Open Watcom C/C++ NMAKE Clone for 386  Version 1.9
Portions Copyright (c) 1995-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See http://www.openwatcom.org/ for details.
set cl=-w -Ox -QIfdiv- -nologo -link -nologo
cl maketab.c -o maketab.exe
maketab.c
.\maketab.exe > proctab.c
cl -o awk95.exe b.c main.c parse.c proctab.c tran.c lib.c run.c lex.c ytab.c mis
sing95.c
b.c
main.c
parse.c
proctab.c
tran.c
lib.c
run.c
lex.c
ytab.c
missing95.c

C:\Programmer\WATCOM\src\awk>COPY awk95.exe %WATCOM%\binnt\awk.exe
        1 fil(er) kopieret.

C:\Programmer\WATCOM\src\awk>EXIT

http://openwatcom.mirror.fr/devel/
dll_example.zip

http://openwatcom.mirror.fr/manuals/current/
devguide.pdf

http://openwatcom.mirror.fr/manuals/
wgmlref.pdf

http://openwatcom.mirror.fr/wiki/
Tutorial.zip

http://openwatcom.mirror.fr/devel/docs/
pe_and_symbols.pdf & pecoff.pdf



http://stroustrup.com/programming.html (2014)
C++11 compiler (for the 2nd edition examples)

http://stroustrup.com/Programming/PPP1.html (2008)
C++98 compiler (for the 1st edition examples)

programming_ch12.pdf

http://stroustrup.com/Programming/FLTK/
fltk-1.1.9-source.zip

Microsoft Windows XP [version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\UserName>CD \

C:\>SET FLTK=C:\fltk-1.1.9

C:\>CD %FLTK%\watcom

C:\fltk-1.1.9\watcom>MOVE config.h %FLTK%

C:\fltk-1.1.9\watcom>wmake

...

Fl_Button.cxx(39): Warning! W716: col(12) integral value may be truncated
Fl_Button.cxx(42): Warning! W716: col(14) integral value may be truncated
Fl_Button.cxx(93): Warning! W716: col(16) integral value may be truncated
wpp386 -DWIN32  -6r -zq -d2 -s -ors -wcd=666 -wcd=836 -bt=nt -fp6 -fpi87 -mf -wc
e=130 -wx -zq -fod_nt\Fl_Chart.obj -zmf -zv -fx Fl_Chart.cxx
C:\fltk-1.1.9\FL\math.h(62): Error! E867: col(30) conflict with a previous using
-decl 'rint'
C:\fltk-1.1.9\FL\math.h(62): Note! N393: col(30) included from Fl_Chart.cxx(28)
C:\Programmer\OW\H\math.h(80): Note! N392: col(10) definition: 'double __watcall
 rint( double )'
C:\fltk-1.1.9\FL\math.h(63): Error! E867: col(44) conflict with a previous using
-decl 'copysign'
C:\Programmer\OW\H\math.h(60): Note! N392: col(10) definition: 'double __watcall
 copysign( double, double )'
Error(E42): Last command making (Fl_Chart.obj) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (BuildOne;dw) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (ALL) returned a bad status
Error(E02): Make execution terminated

C:\fltk-1.1.9\watcom>wmake clean

...

C:\fltk-1.1.9\watcom>

Comment out the code block in %FLTK%\FL\math.h.

//#  if (defined(WIN32) || defined(CRAY)) && !defined(__MINGW32__) && !defined(__MWERKS__)
//inline double rint(double v) {return floor(v+.5);}
//inline double copysign(double a, double b) {return b<0 ? -a : a;}
//#  endif // (WIN32 || CRAY) && !__MINGW32__ && !__MWERKS__

C:\fltk-1.1.9\watcom>wmake

...

screen_xywh.cxx(40): Error! E059: col(25) unable to open 'multimon.h'
screen_xywh.cxx(52): Error! E498: col(50) syntax error before 'MONITORENUMPROC';
 probable cause: incorrectly spelled type name
screen_xywh.cxx(54): Error! E671: col(60) function modifier cannot be used on a
variable
screen_xywh.cxx(54): Error! E327: col(60) typedef cannot be initialized
screen_xywh.cxx(60): Error! E498: col(41) syntax error before 'mon'; probable ca
use: incorrectly spelled type name
screen_xywh.cxx(252): Warning! W014: col(0) no reference to symbol 'num_screens'

screen_xywh.cxx(35): Note! N392: col(12) definition: 'int num_screens'
screen_xywh.cxx(252): Warning! W014: col(0) no reference to symbol 'fl_gmi'
screen_xywh.cxx(56): Note! N392: col(20) definition: 'int * __stdcall fl_gmi'
screen_xywh.cxx(252): Warning! W014: col(0) no reference to symbol 'screens'
screen_xywh.cxx(58): Note! N392: col(13) definition: 'tagRECT screens[16]'
Error(E42): Last command making (screen_xywh.obj) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (BuildOne;dw) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (ALL) returned a bad status
Error(E02): Make execution terminated

C:\fltk-1.1.9\watcom>wmake clean

...

C:\fltk-1.1.9\watcom>

Modify %FLTK%\watcom.mif.

# Set target environment options for the project

!ifeqi TARGET  nt                   # WINDOWS 32 bit
- SYSDEF= -DWIN32
+ SYSDEF= -DWIN32 -D_WIN32_WINNT=0x0500 -DWINVER=0x0500
ASYSDEF=
SYSLIBS=wsock32.lib mpr.lib glu32.lib opengl32.lib
EXEEXT=.exe

# Tell wmake to use DLL versions of some commands (much quicker)
#
!loaddll wcc386 wccd386
!loaddll wpp386 wppd386
+ !ifeqi __VERSION__ 1300
+ !loaddll wlink wlinkd
+ !else
!loaddll wlink  wlink
!endif
!loaddll wlib   wlibd

C:\fltk-1.1.9\watcom>wmake

...

C:\fltk-1.1.9\watcom>EXIT

http://fltk-dev.easysw.narkive.com/SVGoNXQx/multimon-h-missing
Credit on the code changes on watcom.mif to Mat Nieuwenhoven

NB: The current version of Open Watcom V2 is 1300.

From the wiki on the Open Watcom v2 being standards conforming.

circa 22 May 2015 · 2 revisions
https://github.com/open-watcom/open-watcom-v2/wiki/C---Language

circa 22 May 2015 · 2 revisions
https://github.com/open-watcom/open-watcom-v2/wiki/C---Library