Compiling a C++ program on an HFS or zFS file system
- Compile and launch the programs from the same location, or
- specify the full path name when you compile the programs.
By
default, the C++ compiler
stores the relative path and file names of the source files in the
program object. When you start a debug session, if the source is not
in the same location as where the program is launched, z/OS® Debugger does
not locate the source. To avoid this problem, specify the full path
name of the source when you compile the program. For example, if you
execute the following series of commands, z/OS Debugger does
not find the source because it is located in another directory (/u/myid/mypgm
):
- Change to the directory where your program resides and compile
the program.
cd /u/myid/mypgm c++ -g -o "//TEST.LOAD(HELLO)" hello.cpp
- Exit UNIX System Services and return to the TSO READY prompt.
- Launch the program with the
TEST
run-time option.call TEST.LOAD(HELLO) 'test/'
z/OS Debugger finds the source if you change the compile command to:
c++ -g -o "//TEST.LOAD(HELLO)" /u/myid/mypgm/hello.cpp
The same restriction applies to programs that you compile to run in a CICS® environment.
If you are creating .mdbg files, capture the source files into the .mdbg file by specify the -c option with the dbgld command, or the CAPSRC option with the CDADBGLD utility. To learn how to use the dbgld command and the CDADBGLD utility, see z/OS XL C/C++ User's Guide. z/OS Debugger needs access to the .mdbg file to debug your program.