United States    
COMPAQ STORE | PRODUCTS | SERVICES | SUPPORT
| CONTACT US | SEARCH
C++

Frequently Asked Questions

 

This collection of frequently asked questions (FAQ) provides brief answers to general questions about the C++ compiler product and to questions of interest to application developers and other technical users of the compiler.

Identifiers enclosed in brackets refer to Compaq internal notes conferences. You might want to cite these identifiers if you need to contact Compaq Customer Support about a related question.

Questions are followed by an answer (A:); some questions also have a solution (S:), a workaround (W:), or both.

Please select


PRODUCT INFORMATION

  1. Which versions of the compilers are currently available?
  2. Are the compilers Year 2000 Ready?
  3. What are your plans regarding implementation of the C++ International Standard?
  4. I notice that you use the Standard Library from Rogue Wave. Which other Rogue Wave libraries do you support? Can I obtain Tools.h++ for OpenVMS?
  5. Can the C/C++ team keep me informed about new releases?
  6. Which documentation is available? In which formats? How can I obtain it?
  7. Which technical support options are available?

Q1: Which releases of the compilers are currently available?

A: Several versions are available, depending on your operating system. For current version and pricing information, call 1.800.AT.COMPAQ (1.800.282.6672) or contact your local business partner.

Q2: Are the compilers Year 2000 Ready?

A: Yes. The current versions are ready. For information about earlier versions, see the Compaq Year 2000 Page.

Q3: Can the C/C++ team keep me informed about new releases?

A: We do not maintain a list of people to inform. We receive many inquiries on a daily basis and have focused our attention to responding to these emails. If you'd like to keep informed, the best way is to visit the Compaq Software Application Development web site.

Q4: Which documentation is available? In which formats? How can I obtain it?

A: The documentation is packaged as part of the binary kit, and is available in HTML, PostScript, and text format. Once the kit is installed, you can view the HTML documentation by pointing your browser to the directory/file on the system where the kits are installed:

/usr/share/doclib/cplusplus/index.htm

You can obtain a complete hardcopy documentation set by calling 1.800.AT.COMPAQ and requesting item QA-MTRAA-GZ.

This kit contains the following documents:

  • RBI Letter
  • Using Compaq C++
  • Compaq C++ Installation Guide
  • Compaq C Run-Time Library Reference Manual
  • The C++ Programming Language, 3rd edition, by Bjarne Stroustrup.

The RBI Letter, Using Compaq C++, and Installation Guide documents are specific to the operating system.

Release Notes, Software Product Description, Class Library Reference Manual, Standard Library Stream Input/Output, and Standard Library Locales documents are available only online.

Q: Which technical support options are available?

A: Various 24x7 technical support contracts are available. For contract information, call 1.800.AT.COMPAQ. Technical support on a per-call basis is available at 1.800.354.9000.


TECHNICAL QUESTIONS
  1. Which elements of the C++ International Standard are not yet supported?
  2. Does the compiler support precompiled headers?
    [C_PLUS_PLUS 4024]
  3. Why doesn't ident, what, or strings work?
    [C_PLUS_PLUS 4189]
  4. Why can't I find my identification strings in my executable?
    [C_PLUS_PLUS 4189]
  5. Why does check < int > (d) produce the error message
    'Type not followed by "(" in an expression' ?

    [C_PLUS_PLUS 4169]
  6. Why can't I compile -tall for the Standard Library?
    [C_PLUS_PLUS 4133]
  7. Why does the compiler generate an undefined identifier error for a variable I've declared on a for loop?
    [C_PLUS_PLUS 4133]
  8. Why does the compiler generate undefined symbols for functions taking pointer to functions? [C_PLUS_PLUS 4087]
  9. How do I link C++ with another language?
    [C_PLUS_PLUS 3687]
  10. Why does the compiler generate an undefined symbol "WHAT__K9BAD_ALLOCXV"? [C_PLUS_PLUS 3759]
  11. Why must classes reside in headers for automatic template instantiation?
    [C_PLUS_PLUS 3245]
  12. Why does the compiler generate undefined template symbols?
    [C_PLUS_PLUS 3245]
  13. Why does the compiler generate duplicate symbol errors when I use automatic instantiation? [C_PLUS_PLUS 4245]
  14. Why am I having trouble with the Standard Library?
    [C_PLUS_PLUS 4155]
  15. Because the Standard Library does not ship with the operating system, how can my customer obtain the library so that my application will link cleanly on his system?
    [C_PLUS_PLUS 3598, 4645]
  16. Why does the compiler generate undefined nullref and nullref_defined messages?
    [C_PLUS_PLUS 4121]
  17. Why does the compiler receive an internal error, GEM ASSERTION? Why does the compiler crash or produce a core dump?
    [C_PLUS_PLUS 4019]
  18. Why does the compiler warn that /usr/include/pdsc.h has nested comments?
    [C_PLUS_PLUS 4005]
  19. Why does the compiler generate warnings from system header files?
    [C_PLUS_PLUS 4005]
  20. Why are my executables bigger in Version 6.1 than in Version 6.0?

Technical Questions

Q: Which elements of the C++ International Standard are not yet supported?

A: The following items, specified in the C++ International Standard, are not supported in Version 6.2 but will be supported in a future version. Details about each item are provided in the indicated sections of the C++ International Standard document and The C++ Programming Language, 3rd Edition, by Bjarne Stroustrup.
  • Covariant return types (Standard §10.3, paragraph 5; Stroustrup §15.6.2)
  • reinterpret_cast casting a pointer to member of one class to a pointer to member of another class if the classes are unrelated (Standard §5.2, paragraph 10; Stroustrup §6.2.7)
  • Name binding in templates (Standard §14.6, paragraph 9; Stroustrup §C.13.8)
  • Class name insertion (Standard §9, paragraph 2)
  • Putting a try/catch around the initializers and body of a constructor (Standard §9, paragraph 2; Stroustrup §14.4.6)
  • Templates as template parameters (Standard §14.4.3; Stroustrup §C.13.3)
  • Koenig lookup of function names on all calls (Standard §3.4.2, paragraph 2; Stroustrup §8.2.6, §11.2.4)
  • Finding friend functions of the argument class types on name lookup on the function name in calls
  • String literals with a const type (Standard §2.13.4; Stroustrup §5.2.2)
  • Universal character set escapes (for example, \uabcd) (Standard §2.2; Stroustrup §C.3.3)
  • The export keyword for templates (Standard §14, paragraph 6; Stroustrup §9.2.3)
  • <cname> version of headers (Standard §17.4.1.2; Stroustrup §16.1.2)

Q: Does the compiler support precompiled headers?

A: The compiler supports precompiled headers (PCH) on Compaq Tru64 UNIX with Compaq C++ Version 6.0 or higher.

Q: Why doesn't ident, what, or strings work?
Q: Why can't I find my identification strings in my executable?

A: If your identification strings are static and not referenced, the compiler optimizes them away. This breaks tools like ident, what, and strings, which search for strings in the executable. To work around this condition without disabling the optimization, the Version 6.1 compiler recognizes strings beginning with $RCSfile:, $ld:, $header:, and @(#) as being special, so that they are not optimized away.

If the string you want to use does not match one of these patterns, consider using #pragma ident instead.

Q: Why does check < int > (d) produce the error message 'Type not followed by "(" in an expression' ?

A: Explicit specification of function template args is not supported in the Version 5.n compiler. It is only partially supported in our latest Version 6.n compiler; that is, the explicit call syntax works but is not useful because you must use the template argument somewhere in the function declaration. The compiler cannot support this feature without a change in the name mangling mechanism, which would break backward link compatibility (link compatiblity between object files built with Version 6.n and Version 5.n compilers).

Q: Why can't I compile -tall for the Standard Library?

A: Because this option instantiates all templates, even those that are not used, it is not guaranteed to work with the Standard Library.

For example, rb_tree (the underlying implementation of map and set) supports a bidirectional iterator class. Thus, operator+, operator-, operator<, and operator> are not defined in the iterator for that class. When you instantiate the tree with cxx -tall, the compiler tries to instantiate recursively everything that is typedef'ed, even if not used.

Inside rb_tree there is a typedef for std::reverse_iterator<iterator>, which then instantiates the global class reverse_iterator with the rb_tree iterator as the template argument "RandomAccessIterator" (a misnomer in this case).

This condition causes undefined symbols for these operators, because the symbols are used within the definition of the operator member functions inside reverse_iterator. As a result, the compiler attempts to instantiate them, even though they do not exist.

Q: Why does the compiler generate an undefined identifier error for a variable I've declared on a for loop?

A: The C++ International Standard has changed the scope rule for variable declared on a for loop. According to the standard, the scope ends at the end of the scope of the for loop. Compiling -std arm will give you the old ARM scoping rules. See Scope of Variables Declared on a for Statement in Using Compaq C++ for Compaq Tru64 UNIX.

Q: Why does the compiler generate undefined symbols for functions taking pointer to functions?

A: The linkage of the function that is pointed to is now part of the function type.

From Standard §7.5; Stroustrup §9.2.5:

In a linkage specification, the specified language linkage applies to the function types of all function declarators, function names, and variable names introduced by the declaration. For example:
extern "C" void f1(void (*pf)(int)); 
         // the name f1 and its function type have C linkage;
         // pf is a pointer to a C function

In the following example, the argument errFunc has C linkage in the declaration but has C++ linkage in the definition in func.cpp. As a result, the declaration and definition do not match.

// func.h

extern "C"
{
void Test_OK(char *msg);
typedef void (*fp)(char*);
void Test_Not_OK(fp);
}

// func.cpp
#include <func.h>

void Test_Not_OK(fp errFunc)
{
  errFunc("Test not OK");
}

S: Create a typedef with either C or C++ linkage and use it as the argument type.

Q: How do I link C++ with another language?

A: See Using Compaq C++ with Other Languages. One caveat for linking with Fortran is that in many cases Fortran add a trailing underscore to its external name. The externC declaration must include this underscore when you define an external Fortran name. See -assume nounderscore in the Fortran f77 and f90 reference pages.

Q: Why does the compiler generate undefined symbol WHAT__K9BAD_ALLOCXV?

A: The library object file bv_inst.o, which was created incorrectly, contains an undefined symbol bad_alloc::what().

If you #include <vector>, some inline functions in the bitvector class (at the bottom of the vector header file) cause the linker to require references from bv_inst.o. The unresolved error occurs when the linker includes that object file. Though disconcerting, the linker error is harmless.

S: This problem has been fixed in Version 6.n of the Standard Library.

W: In most cases, you can ignore the linker message. It is a problem only if a shareable image is being created (because any application linking against it also receives the warning.

Q: Why must classes reside in headers for automatic template instantiation?
Q: Why does the compiler generate undefined template symbols?

A: This was a limitation in the Version 5.n compilers that has been fixed in the Version 6.n compilers. For more information about Version 5 template limitations, see the discussion of templates in your Version 5.n Using DEC C++ guide.

S: Upgrade to Version 6.0 or higher.

Q: Why does the compiler generate duplicate symbol errors when I use automatic instantiation?

A: This was a limitation in the Version 5.n compilers that has been fixed in the Version 6.n compilers. For more information about Version 5 template limitations, see the discussion of templates in your Version 5.n Using DEC C++ guide.

Note also that you cannot do automatic template instantiation if you defined templates and non-templates in the same module. This restriction applies because each time the compiler needs the template implementation, it includes the module that defines it. If that module contains non-template elements, these also are defined, and duplicate symbols can be generated.

Consider the following example:


mynode> cxx -o tt m.cxx m2.cxx t.cxx
m.cxx:
m2.cxx:
t.cxx:
ld (prelink):
m2.o compressed: worker_function(void): multiply defined
t.o compressed: worker_function(void): multiply defined
ld (prelink):
m2.o compressed: worker_function(void): multiply defined
t.o compressed: worker_function(void): multiply defined
ld:
m2.o compressed: worker_function(void): multiply defined
t.o compressed: worker_function(void): multiply defined

mynode> nm m.o | grep worker
worker_function(void)            | 0000000000000080 | T | 0000000000000008
mynode> nm m2.o | grep worker
worker_function(void)            | 0000000000000064 | T | 0000000000000008
mynode> nm t.o | grep worker
worker_function(void)            | 0000000000000000 | T | 0000000000000008

mynode> cat t.h
#ifndef T_H
#define T_H
template  void f(const T);
#endif

mynode> cat t.cxx
#include "t.h"

void worker_function() { }

template  void f(const T) { worker_function(); }

mynode> cat m.cxx
#include "t.h"

extern void m2();

void main()
{
  f(1);
  m2();
}

mynode> cat m2.cxx
#include "t.h"

void m2()
{
  f("hello");
}

For information about where to place function definitions depending on whether they are templatized, see How to Organize Your C++ Code in Using Compaq C++ for OpenVMS Alpha

Q: Why am I having trouble with the Standard Library?
Q: Why does the Standard Library produce the warning message 'qualifier is meaningless on cast type'?

A: When using Standard Library container classes with Compaq C++ Version 6.n, you might receive a message like the following:
cxx: Warning: /usr/include/cxx/utility, line 131: type qualifier 
    is meaningless on cast type detected during: 
    instantiation of "std::pair<const int, char>::pair() 
    ... 
    : first(T1()), second(T2()) 
    --------^ 

The preceding was generated from the following:
    typedef multimap<int, char, less<int> > mmap; 
    typedef pair<int, char> pair_type; 
    pair_type p1 (3, 'c'); 
    pair_type p2 (4, 'd'); 
    ... 
    pair_type array [] = {p1,p2,p3,p4,p5,p6};     
    mmap m (array, array + 6);   

The reason for this warning is that internally the container classes may make calls to Standard Library utilities like pair() which make use of functional-notation casts. For example pair() makes use of first(T1()). In this example T1() is a functional-notation cast to type T1. The type in a functional-notation cast has to be a single type identifier. Internally the library may add the const qualifier to a template type to ensure "constness". In the above example this has happened leading to an instantiation of first (const int()), which generates a warning.

S: This problem is corrected in Version 6.1 for Compaq Tru64 UNIX.

W: Disable the message on the command line.

Q: Because the Standard Library does not ship with the operating system, how can my customer obtain the library so that my application will link cleanly on his system?

A: You can redistribute the library under conditions specified in the C++ Software Product Description. For detailed information about how to do so, see Deploying Your Application in Using Compaq C++ for Tru64 UNIX.

Q: Why does the compiler generate undefined nullref and nullref_defined messages?

A: The headers and the library shipped with the Version 6.0 compiler were not consistent.

S: Upgrade to Version 6.1 or higher.

Q: Why does the compiler receive an internal error, GEM ASSERTION?
Q: Why does the compiler crash or produce a core dump?

A: This is a Version 6.0 compiler problem. Users of the Version 6.0 compiler can encounter a GEM ASSERTION on code containing the expression b ? true : false.

You can search for occurrences in your code by enterting:
 grep "?" *.cxx *.h | grep true
and
 grep "?" *.cxx *.h | grep false

S: Upgrade to the latest version. If the problem persists, please report it to customer support. Be prepared to supply a preprocessed file along with the compiler flags that you are using.

Q: Why does the compiler warn that /usr/include/pdsc.h has nested comments?

A: This has been fixed in DIGITAL UNIX 4.0E or later.

If you want to suppress warnings about system headers, use the -SD switch in Version 6.1 or higher. In earlier versions, protect the headers. See the protect_headers_setup(8) reference page and the -protect_headers switch in the cxx(1) reference page.

Q: Why does the compiler generate warnings from system header files?

A: You can suppress the warnings by using the -SD switch in Version 6.1 or higher. In earlier versions, protect the headers. See the protect_headers_setup(8) reference page and the -protect_headers switch in the cxx(1) reference page.

Q: Why are my executables bigger in Version 6.1 than in Version 6.0?

A: One possible reason for an increase in image size is the introduction of a pre-instantiation library for commonly used instantiations.

To help speed up links, some commonly used templates are pre-instantiated and placed in libcxxstd.a. However, because of the way they are packaged, if you reference one, you get them all. You get everything that the templates reference, which is almost the entire library.

For large, multi-file executables, the size difference shrinks and the build speedup is significant. However, smaller executables might be up to about 600K larger.

W: Remove inst.o and inst_64.o from the libcxxstd.a and compile
with -D__FORCE_INSTANTIATIONS.

  

1.800.AT.COMPAQ

privacy and legal statement