Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


(2 +), if the compiler how

Procedures for the use of the template, using the g++,3.3.2 version. -fno-implicit-templates Started to use parameters, the compiler not to the past, can be translated through the use of, but this time connect (linker) is not connected to the past. Some information on the investigation, -fno-implicit-templates linker and the parameter as a conflict! really do not know how to solve, and how they hire high places to help

(2 +), if the compiler how

Not so many things that you look at the code cards Levin

(2 +), if the compiler how

#ifndef _A_H__
# _A_H__
#include "Vector>;
#include "Algorithm>;
#include "List>;
                                                                                                                             
Template "class Type>;
14.00 TTT{
Private :
Type a;
Public :
Int put (Type t);
Type get ();
                                                                                                                             
TTT (Type in)
{
A =in;
                                                                                                                             
}
};
                                                                                                                             
                                                                                                                             
                                                                                                                             
Template "class Type>;
Type : : get TTT<Type>; ()
{
                                                                                                                             
Return a;
                                                                                                                             
}
                                                                                                                             
Template "class Type>;
Int TTT<Type>; : : put (Type t)
{
A =t;
Return 0
}
#endif
///////////////////////
#ifndef _B_H__
# _B_H__
#include "Ah>;
Template<class Type>;
Int bfun (Type in);
                                                                                                                             

#endif


////////////////
#include<bh>;
Template<class Type>;
Int bfun (Type in)
{
TTT<int>; tons.
T.put (in);
Type out t.get = ();
Return 0
                                                                                                                             
}
                                                                                                                             
////////////////
#include "Stdio.h>;
//#include "Ah>;
Include "bh>;

Int main ()
{
Int a Z
                                                                                                                             
A =bfun (555);
                                                                                                                             
Printf ( "output=%d\n", a);
Return 0
}


///////////////
What is the translation error

. /main.o (. Text+0x20) : In function `main ':
/home/wwm/kbase/test/t4/test/main.cpp:26 : Undefined reference to `int bfun<int>; (int) '

(2 +), if the compiler how

You put the code on the paper, to have to write a makefile, and if these codes on the same document should not have such problems, and in addition, it should be :
[code]
Include "bh"
[/code]
Rather than
[code]
Include "bh>;
[/code]

(2 +), if the compiler how

[code]template<class Type>;
Int bfun (Type in)
{
TTT<int>; tons.
T.put (in);
Type out t.get = ();
Return 0
}[/code]

Bh in these documents should not put b.cpp documents.
Otherwise, your compiler to support the export keyword. (G++ seems not support)



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com