Title: | C++ |
Notice: | Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS) |
Moderator: | DECCXX::AMARTIN |
Created: | Fri Nov 06 1987 |
Last Modified: | Thu Jun 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 3604 |
Total number of notes: | 18242 |
UNIX V3.2D-2 & V4.0B C++ V5.5-004 The sample program below enables me to ask you two questions. 1. About the -ptv option: The program properly builds. When the option -ptv is added, it, however, generates, as shown, a message refering to a symbol which cannot be translated. Note that the symbol differs given the version of the o.s. What does this means ? Is it an error ? Note that the executable is generated and runs properly. 2. About compiler directives: If no instanciation directive is given, the build fails, complaining about an invalid declaration. Looking to the generated file where the problem occurs, it appears that the macro definition (#define) specified in the source, is not passed to this file. But #include instructions are. Is there a rule ? Which one ? Thanks in advance for the information. Mich�le. ========= vub.cxx ========= #include <stream.h> template <class T> class myClass { public: void ff(); }; #define TYPE int template <class T> void myClass<T>::ff() { #include "ff.h" } void main() { myClass<double> A; A.ff(); } ====== ff.h ====== TYPE var = 5; T val = 6; cout << var << " " << val << " in ff()" << endl; =================== -ptv build output =================== On UNIX V3.2D-2: $ cxx -define_templates -o vub vub.cxx -ptv Writable_repository: ./cxx_repository Repository_list: ./cxx_repository prelinker invoked Line read from pipe: ldr_process_context [ref: /usr/shlib/libc.so] Couldn't translate symbol: ldr_process_context On UNIX V4.0B: $ cxx -define_templates -o vub vub.cxx -ptv Writable_repository: ./cxx_repository Repository_list: ./cxx_repository prelinker invoked Line read from pipe: _end [ref: /usr/shlib/libc.so] Couldn't translate symbol: _end ================================= cxx without instanciation error ================================= cxx: Error: ./ff.h, line 8: Invalid declaration. TYPE var = 5; --------^ cxx: Error: ./cxx_repository/myClass__Td.cxx, line 3: Invalid declaration. typedef myClass<double > __dummy_; ---------------^ ld: Unresolved: myClass<double>::ff(void) ./cxx_repository/myClass__Td.cxx ================================ #include <stream.h> #include "ff.h" typedef myClass<double > __dummy_;
T.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
3485.1 | Possibly because -ptv and -define_templates options are combined? | BEGIN::ROTITHOR | Tue Mar 11 1997 11:11 | 13 | |
slab.zko.dec.com> cxx -define_templates -o vub vub.cxx slab.zko.dec.com> vub 5 6 in ff() slab.zko.dec.com> cxx -V cxx (cxx) DEC C++ V5.5-004 on Digital UNIX (Alpha) -define_templates looks like a more appropriate option for the structure of this code. If you want to sepcify auto-instantiation, the template defn can be moved to a separate header file. The _end symbol translation seems to be a warning (why?) and does not appear if verbose mode is not specified (-pt instead of -ptv) | |||||
3485.2 | more about -ptv | BACHUS::SABLON | Mich�le Sablon, TP/IM Support Belgium 856-7238 | Tue Mar 11 1997 11:53 | 8 |
.1 The same behaviour when using another option forcing instanciation. E.g. -tlocal, -tused. And also after reorganizing the program into main, template.cxx and template.hxx with no option specified out of -ptv. Mich�le. | |||||
3485.3 | ignore the "Couldn't translate symbol:" messages | DECC::SEIGEL | Tue Mar 11 1997 12:14 | 10 | |
You can ignore messages like the following: Line read from pipe: _end [ref: /usr/shlib/libc.so] Couldn't translate symbol: _end -ptv was originally written to aid the developers of the template support. Hence, it can cause lots of messages to be generated that do not make sense to C++ users. Harold | |||||
3485.4 | why #include and not #define ? | BACHUS::SABLON | Mich�le Sablon, TP/IM Support Belgium 856-7238 | Thu Mar 13 1997 04:49 | 7 |
Thanks for your answers about -ptv. Anybody about why the #include instructions are passed to the generated sources in the repository and not the #define instructions ? Thanks in advance, Mich�le. |