if [ $# -lt 2 ]
then
echo "Please provide 2 file names";
exit
fi
while read LINE
do
echo $LINE >> $2
done < $1
then
echo "Please provide 2 file names";
exit
fi
while read LINE
do
echo $LINE >> $2
done < $1
template<typename T>
int t(T i)
{ return f(i); }
int f(int i)
{ return i; }
int main()
{
return t(1);
}
------------------------------
compile with gcc < 4.7 but will result in the following error if gcc >= 4.7:In instantiation of ‘int t(T) [with T = int]’ required from here
error: ‘f’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
note: ‘int f(int)’ declared here, later in the translation unit
--------------f
in the code above is declared before first use in function t
. Like so:int f(int i)
{ return i; }
template<typename T>
int t(T i)
{ return f(i); }
int main()
{
return t(1);
}
While compiling specify the flag---------------------
Work around:
-fpermissive
.