P
Patrick Guio
Hi,
I have trouble to compile the following piece of code with g++3.4 but not
with earlier version
// Foo.h
template<typename T>
class Foo
{
public:
void f();
};
// Foo.cpp
#include <iostream>
#include "Foo.h"
template<typename T>
void Foo<T>::f()
{
std::cout << "Foo<T>::f()\n";
}
template Foo<int>;
// main.cpp
#include "Foo.h"
int main()
{
Foo<int> x;
x.f();
}
The error message when using g++3.4 is
Foo.cpp:10: error: expected unqualified-id before ';' token
i.e. the template command "template Foo<int>;"
Is this syntax not standard?
Cheers,
Patrick
I have trouble to compile the following piece of code with g++3.4 but not
with earlier version
// Foo.h
template<typename T>
class Foo
{
public:
void f();
};
// Foo.cpp
#include <iostream>
#include "Foo.h"
template<typename T>
void Foo<T>::f()
{
std::cout << "Foo<T>::f()\n";
}
template Foo<int>;
// main.cpp
#include "Foo.h"
int main()
{
Foo<int> x;
x.f();
}
The error message when using g++3.4 is
Foo.cpp:10: error: expected unqualified-id before ';' token
i.e. the template command "template Foo<int>;"
Is this syntax not standard?
Cheers,
Patrick