Compile the client executable

StepsCompiling the client on Windows

  1. Verify your setup as described in “Verify your environment”.

  2. Create a batch file with these commands and run it:

    SETLOCAL
    set INCLUDE=.;%DJC_HOME%\include;%INCLUDE%;
    set LIB=%DJC_HOME%\lib;%LIB%
    cl /W3 /nologo /DWIN32 /Gd /GX -c arith.cpp
    set SYSLIBS=kernel32.lib advapi32.lib
    link /MAP /out:arith.exe arith.obj libjcc.lib libjutils.lib %SYSLIBS%
    ENDLOCAL
    

StepsCompiling the client on UNIX

  1. Verify your setup as described in “Verify your environment”.

  2. Create a shell script containing the commands for your platform from Table 10-2, then run the shell script.

  3. Change the script file permissions to allow execution, for example, assuming you have named the script compile.sh:

    chmod 777 compile.sh
    
Table 10-2: Client compilation commands for UNIX platforms

Platform

Shell script

Solaris

This shell script works with the Solaris CC compiler, version 6.x:

#!/bin/sh
. $DJC_HOME/bin/djc-setenv.sh
CC -DJAG_NO_NAMESPACE -z muldefs -I. -I$DJC_HOME/include \
-L$DJC_HOME/lib -ljcc -ljtml_r -lunic -lnsl \
-ldl -lthread -lm -ljutils -o arith arith.cpp

HP-UX

This shell script uses the HP-UX ANSI C++ (aCC) compiler:

#!/bin/sh
. $DJC_HOME/bin/djc-setenv.sh
aCC -c  +DA1.1 +DS2.0 +u4 -DNATIVE -D_HPUX -D_POSIX_C_SOURCE=199506L \
  -D_HPUX_SOURCE -I $(DJC_HOME_JDK13)/include -I $(DJC_HOME_JDK13)/include/hp-ux -I. \
  -I$DJC_HOME/include -L$DJC_HOME/lib -lpthread -ljcc -lnsl -ljtml_r \
  -ljinsck_r -lunic -ljutils -o arith arith.cpp 

HP Itanium

This shell script uses the HP C++ (aCC) compiler:

#!/bin/sh
. $DJC_HOME/bin/djc-setenv.sh
aCC -g +DD32 -mt -I. -I$(DJC_HOME)/include \
-L$(DJC_HOME)/lib -lpthread  -lunic -ljtml_r -ljinsck_r \
-ljcc -lnsl -ljlog -o arith arith.cpp

AIX

This shell script uses the IBM native compiler:

#!/bin/sh
. $DJC_HOME/bin/djc-setenv.sh
xlC_r -g -c -DDEBUG -DJAG_NO_NAMESPACE -DAIX -D_AIX -qcpluscmt -qnoro \
  -qmaxmem=-1 -qarch=com -qtbtable=full \
  -I. -I$DJC_HOME/include  \
  -brtl -L$DJC_HOME/lib -ljcc.so -lunic -ljtml_r.so -ljinsck_r.so \
  -lpthread -lnsl -ljutils -o arith arith.cpp

Linux

This shell script uses the g++ compiler:

#!/bin/sh
. $DJC_HOME/bin/djc-setenv.sh
g++ -c -D_GNU_SOURCE=1 -DLINUX -D_LINUX -D_REENTRANT -fPIC \
  -fwritable-strings -pipe -g -DDEBUG -I $(DJC_HOME_JDK13)/include \
  -I. -I$DJC_HOME/include \
  -L$DJC_HOME/lib -lpthread -ljcc -lnsl -ljtml_r -ljinsck_r \
  -l unic -ljutils -o arith arith.cpp