I have Foo
and Bar
as follows:
Foo.h
#include <list>
using namespace std;
class Foo
{
private:
template <typename BarT>
list<BarT*> barT_lst;
public:
template <typename BarT>
Foo(void);
~Foo(void);
};
Foo.cpp
#include "Foo.h"
template <typename BarT>
Foo::Foo(void)
{
}
Foo::~Foo(void)
{
}
Bar.h
class Bar
{
public:
Bar(void);
~Bar(void);
};
Bar::Bar(void)
{
}
Bar::~Bar(void)
{
}
And main()
#include "Foo.h"
#include "Bar.h"
int _tmain(int argc, _TCHAR* argv[])
{
Foo<Bar> foo = Foo<Bar>();
return 0;
}
I use VC++2008. Every time when I build project, it shows errors:
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1>Compiling...
1>Test.cpp
1>c:\users\duong2179\documents\visual studio 2008\projects\test\test\foo.h(12) : fatal error C1001: An internal error has occurred in the compiler.
1>(compiler file 'msc1.cpp', line 1411)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1>Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1>Build log was saved at "file://c:\Users\duong2179\Documents\Visual Studio 2008\Projects\Test\Test\Debug\BuildLog.htm"
1>Test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This looks very strange. Please help!