I am getting an error when compiling a cpp file which includes implementation of template.
ERROR IS:
/tmp/cc9YgzIB.o(.text+0x7a): In function `__static_initialization_and_destruction_0(int, int)':
: undefined reference to `std::ios_base::Init::Init[in-charge]()'
/tmp/cc9YgzIB.o(.text+0xa9): In function `__tcf_0':
: undefined reference to `std::ios_base::Init::~Init [in-charge]()'
/tmp/cc9YgzIB.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
Myfile is:
#include<iostream>
#include<stdio.h>
template<class T>
void swap(T &a,T &b)
{
T temp=a;
a=b;
b=temp;
}
int main()
{
int a,b;
char *c,*d;
printf("enter the values of a and b \n");
scanf("%d %d",&a,&b);
printf("enter the values of c and c \n");
scanf("%s %s",c,d);
swap(a,b);
swap(c,d);
printf("the values of a=%d ,b=%d " ,a,b);
printf("the values of c=%s ,d=%s ",c,d);
return 0;
}