L
lallous
file: prog1.cpp
#include <stdio.h>
#include "temp1.h"
int main()
{
double d;
Templ1::func(d);
return 0;
}
file: temp1.h
namespace Templ1
{
template <class T> void func(T &);
}
file:temp1.cpp
namespace Templ1
{
template <class T> void func(T &i)
{
i = 0;
}
}
When I compile using VC, I get:
Linking...
prog1.obj : error LNK2001: unresolved external symbol "void __cdecl
Templ1::func(int &)" (?func@Templ1@@YAXAAH@Z)
Debug/prog1.exe : fatal error LNK1120: 1 unresolved externals
How can I still use templated version func() from different module (temp1.*)
Regards,
Elias
#include <stdio.h>
#include "temp1.h"
int main()
{
double d;
Templ1::func(d);
return 0;
}
file: temp1.h
namespace Templ1
{
template <class T> void func(T &);
}
file:temp1.cpp
namespace Templ1
{
template <class T> void func(T &i)
{
i = 0;
}
}
When I compile using VC, I get:
Linking...
prog1.obj : error LNK2001: unresolved external symbol "void __cdecl
Templ1::func(int &)" (?func@Templ1@@YAXAAH@Z)
Debug/prog1.exe : fatal error LNK1120: 1 unresolved externals
How can I still use templated version func() from different module (temp1.*)
Regards,
Elias