N
neojohn75
Hello,
I have a class with a number of functions like this one.
typedef unsigned char Pixel;
.....
template <class T>
void Image2D<T>::Char2Pixel(Pixel * c, T *p, int dimx, int dimy){
int i,j,k=0;
for(i=0;i<dimy;i++)
for(j=0;j<dimx;j++,k++){
p[k] = (T) c[k];
}
}
I can compile the class successfully. Now, I'm trying to generate a
shared library, but during the linking process I get the following
errors for all the my functions.
.....
libexample.so: undefined reference to `Image2D<unsigned
char>::Char2Pixel(unsigned char*, unsigned char*, int, int)'
libexample.so: undefined reference to
`Image2D<short>::Char2Pixel(unsigned char*, short*, int, int)'
libexample.so: undefined reference to
`Image2D<float>::Char2Pixel(unsigned char*, float*, int, int)'
.....
Any ideas what I'm doing wrong with my templates?
Thanks!
I have a class with a number of functions like this one.
typedef unsigned char Pixel;
.....
template <class T>
void Image2D<T>::Char2Pixel(Pixel * c, T *p, int dimx, int dimy){
int i,j,k=0;
for(i=0;i<dimy;i++)
for(j=0;j<dimx;j++,k++){
p[k] = (T) c[k];
}
}
I can compile the class successfully. Now, I'm trying to generate a
shared library, but during the linking process I get the following
errors for all the my functions.
.....
libexample.so: undefined reference to `Image2D<unsigned
char>::Char2Pixel(unsigned char*, unsigned char*, int, int)'
libexample.so: undefined reference to
`Image2D<short>::Char2Pixel(unsigned char*, short*, int, int)'
libexample.so: undefined reference to
`Image2D<float>::Char2Pixel(unsigned char*, float*, int, int)'
.....
Any ideas what I'm doing wrong with my templates?
Thanks!