The Question is:
CXXLINK with local "header_files.h"
DEC C++ V6.0-001 on OpenVMS Alpha V7.1
When ever I compile my class definitions, I
never see any entries in the repository
directory expect for CXX$DEMANGLER_DB (which is
empty). (But I always see *.OLB files in the
repository when I compile examples from
When I link with a driver program, such as to
test my list, queue, or stack classes, I then
see entries in the repository, but only if my
header files are declaired as local #include
"list.hpp", "queue.hpp", etc... and are
in the same directory as the source and object
But when I place the header files in a common
area/directory such as
#include "usr01:[public.inc]queue.hpp", etc..
all of my programs compile fine, just like as
before but when I try to link them (driver)I
get the following message:
%LINK-W-USEUNDEF, undefined symbol
List<int>::List() referenced. Other undefined
symbol messages reference other member
functions of my list class.
This problem occurs with all of my programs
only when my local header files are not in the
same directory as the source or object files.
Please tell me what's going on because I would
like to have all of my header files in a common
directory, just like I do with my 'C' header
files. And could you please explain to me how
the repository works or where I can find some
info on it, because I cannot find any
repository info in any of my documentation.
By the way, my driver program has the following
and it compiles with no problems, and there are
no entries in the repository.
Terry D. Frierson
The Answer is :
Without an example of the problematic source code and the associated
error messages, the OpenVMS Wizard can only guess -- the OpenVMS Wizard
can only guess that the problem involves the template declaration files,
and specifically that the template declaration files are not in the
same directory as the template definition files.
When code is "templatized", the C++ compiler needs to have access to
all of the template function definitions at compile time in order to
instantiate them. Thus all the template function definitions must be
located in header files.
The definitions can either be placed in the same header file as the
template declarations (eg: list.hpp would contain the definitions),
or they can be put in a special template definition header file -- a
file which must have the same prefix as the template declaration file
(list) and one of a special set of suffixes (i.e. .cc, .cxx). This
template definition header file should be put in the same directory
as the template declaration file.
For a simple example, please see the section "How to organize Your C++
code" (in Section 3.4 in the current edition) of the C++ Users Guide.