* Bug in cxx (?)
@ 1997-02-24 5:00 Tobias Gloth
1997-02-25 5:00 ` Martin Vorlaender
0 siblings, 1 reply; 2+ messages in thread
From: Tobias Gloth @ 1997-02-24 5:00 UTC (permalink / raw)
I try to port a software package that already runs on Linux, Solaris,
IRIX and AIX (everywhere both with the native C++-Compiler and with
g++) to OSF1. When I used g++, I had no trouble. However, I can't
get it to work with cxx. This is what happens:
* When I compile and link and everything normally (no speciel compiler
flags), I get lots of unresolved Symbols (caused by non-instantiated
templates). This happend with static libraries as well as with
shared ones (I hope I built them correlty. I used the no special
compile-flags and "ld -r -o libxxx.so file1.o file2.o ...").
So I had a look at the man-page which told me that the compile-option
-define_templates could help.
* When I used "-define_templates", I get many strange error-messages
like "file.cc:x: error: in this statement, "someMethod" is not a
member of "variable". Looking at the code I thing that the compiler
is wrong. No other compiler ever complained in such a way, so it
looks like a cxx-problem to me. And I get lots of these errors.
The version is (cxx -V) "DEC C++ V1.3B-0 for DEC OSF/1 (Alpha)",
running on (uname -a) "OSF1 xpi413 V3.0 358 alpha".
Here a comes short program that triggers the problem:
----
template<class T>
class Bar;
template<class T>
class Foo {
friend Bar<T>;
int dummy;
};
template<class T>
class Bar {
void func();
Foo<T>* foo;
};
template <class T>
void Bar<T>::func() {
foo->dummy;
}
Foo<int> member;
----
$ cxx -define_templates -c bug.cc
bug.cc:18: error: In this statement, "dummy" is not a member of "foo".
Compilation terminated with errors.
----
If I omit the "-define_templates", everything compiles fine...
Any comments are greatly appreciated,
Thanks, Tobias
--
Tobias Gloth | WWW: http://wwwmath.uni-muenster.de/~gloth
Schmitthausweg 8 | mail: gloth@math.uni-muenster.de
48161 Muenster | phone: 02533-7111
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Bug in cxx (?)
1997-02-24 5:00 Bug in cxx (?) Tobias Gloth
@ 1997-02-25 5:00 ` Martin Vorlaender
0 siblings, 0 replies; 2+ messages in thread
From: Martin Vorlaender @ 1997-02-25 5:00 UTC (permalink / raw)
Tobias,
I only know the DEC C++ compiler for OpenVMS; could be the same code
base though.
Tobias Gloth (gloth@uni-muenster.de) wrote:
: I try to port a software package that already runs on Linux, Solaris,
: IRIX and AIX (everywhere both with the native C++-Compiler and with
: g++) to OSF1.
[...]
: So I had a look at the man-page which told me that the compile-option
: -define_templates could help.
On VMS, it's not "could help"; this switch is required.
:
: * When I used "-define_templates", I get many strange error-messages
: like "file.cc:x: error: in this statement, "someMethod" is not a
: member of "variable". Looking at the code I thing that the compiler
: is wrong. No other compiler ever complained in such a way, so it
: looks like a cxx-problem to me. And I get lots of these errors.
Try to move the class definitions and declarations to a header file. The
DEC C++ compiler (at least on OpenVMS) resolves templates by generating
instantiated versions in temp files in a repository directory. To do
this, it must be able to include all of the necessary headers.
It could be a good idea to take a more thorough look at the cxx man page,
especially if it has a section on templated classes...
Hope it helps,
Martin
--
| Martin Vorlaender | VMS programmer
"UNIX is user friendly. | work: mv@pdv-systeme.de
It's just selective about | home: martin@radiogaga.harz.de
who its friends are." | http://www.harz.de/~martin/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1997-02-25 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-02-24 5:00 Bug in cxx (?) Tobias Gloth
1997-02-25 5:00 ` Martin Vorlaender
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox