Operating System - OpenVMS
1830241 Members
1758 Online
109999 Solutions
New Discussion

C++ template problem with DEC C/C++ compiler V5.6

 
tnguyen
Occasional Contributor

C++ template problem with DEC C/C++ compiler V5.6

I have an Alpha system running on OpenVMS V7.1 with DEC C/C++ compiler V5.6. CXXLINK prints an error message "undefined symbol" when I try to link a C++ program using templates. Following is the test.cxx program (by the way this program is compiled and linked OK with HP C++ compiler V6.5).

#include

template void f(T) {
printf("In template f\n");
}

void f(int);

int main() {
f(0);
f(0.0);
return 0;
}

void f(int) {
printf("In non-template f\n");
}


CXX test.cxx ok
CXXLINK test

f(p1);
%CXX-E-UNDECLARED, In this statement, "f" is not declared.
at line number 4 in file [.CXX_REPOSITORY]F__XD.CXX;4
%LINK-W-NUDFSYMS, 1 undefined symbol:
%LINK-I-UDFSYM, void f(double)
%LINK-W-USEUNDEF, undefined symbol void f(double) referenced


*** Please let me know what can I do to get this program to work with C++ compiler V5.6, or do I have to upgrade to newer version of HP CXX compiler.
If I need to upgrade newer version of HP CXX compiler (like V6.0 or above), where can I get the compiler.

Attached is the test.cxx file.

Best regards.
2 REPLIES 2
Steven Schweda
Honored Contributor

Re: C++ template problem with DEC C/C++ compiler V5.6

> [..] C++ compiler V5.6 [...]

Sometimes the "-xxx" in the version matters,
but that one's pretty old, isn't it? ("July
22, 1997", it says in my release notes.)

I know nothing (or almost nothing) about C++,
but I do have one:

alp $ cxx /version
HP C++ V7.3-009 for OpenVMS Alpha V7.3-2

(_Its_ release notes say, "April 3, 2007".)

And, around here:

alp $ cxx 295792.cxx
alp $ cxxlink 295792.obj
alp $ run 295792.exe
In non-template f
In template f
alp $

So, knowing nothing, I'd say that a newer
compiler might help in your case.
Steven Schweda
Honored Contributor

Re: C++ template problem with DEC C/C++ compiler V5.6

To run experiments with current software
yourself, you might investigate:

http://www.testdrive.hp.com

Only IA64 systems, now, for VMS, but many
things work the same.