got this strange error: "Warning (Anachronism): Using aTester as a template without a declaration."

got this strange error: "Warning (Anachronism): Using aTester as a template without a declaration."

Post by Tobias Eriksso » Sat, 11 Dec 1999 04:00:00



Hi
 I tried to compile the ACE framework on Solaris 2.6, Sun C++ 5.0.
But I got some strange error saying that the class was not declared, in
the declareation of it?
Below is the error message and source. I wounder why this does not work,

it seems to be ok for line 35 but not for 36. Further down in the source
file the real
class declaration of the Tester class can be found but, I mean I've done
like this
before, although just with "class" not "template class" but still.
Furthermore it seems
to work fine with Sun C++ 4.2 (haven't really checked, but the
compilation works out ok).

If you got any idea, please send me an e-mail.

Regards
 Tobias

%ryps1:/sdp/workarea/ACE+TAO/ACE_wrappers/examples/Threads>make
CC -mt -g -library=iostream,no%Cstd -instances=explicit
-DACE_NO_INLINE  -I/sdp/workarea/ACE+TAO/ACE_wrappers
-DACE_HAS_EXCEPTIONS  -c -o .obj/tss1.o tss1.cpp
"tss1.cpp", line 36: Warning (Anachronism): Using aTester as a template
without a declaration.
"tss1.cpp", line 36: Error: aTester is not defined.
1 Error(s) and 1 Warning(s) detected.
make: *** [.obj/tss1.o] Error 1

The source looks like ths:
    24  #include "ace/Service_Config.h"
    25  #include "ace/Synch.h"
    26  #include "ace/Task.h"
    27
    28  ACE_RCSID(Threads, tss1, "tss1.cpp,v 4.13 1999/08/31 17:13:17
schmidt Exp")
    29
    30  #if defined (ACE_HAS_THREADS)
    31
    32  #include "thread_specific.h"
    33
    34  #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
    35  template class ACE_TSS<Errno>;
    36  template class Tester<ACE_MT_SYNCH>;
    37  #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
    38  #pragma instantiate ACE_TSS<Errno>
    39  #pragma instantiate Tester<ACE_MT_SYNCH>
    40  #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
    41

--
----------------------------------------------
Tobias Eriksson M.Sc.S.E.
Software Engineer
Prepaid Design
Ericsson Software Technology


Direct: +46 457 775 62
Office: +46 457 775 00
ECN:    864 75 62
Fax:    +46 457 270 35
----------------------------------------------