Click here to Skip to main content
15,917,862 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralSome MFC design issue..! Pin
Halloko14-Dec-03 12:21
Halloko14-Dec-03 12:21 
GeneralNetwork Monitoring Pin
Chechi14-Dec-03 8:10
Chechi14-Dec-03 8:10 
GeneralRe: Network Monitoring Pin
David Crow15-Dec-03 6:56
David Crow15-Dec-03 6:56 
GeneralRe: Network Monitoring Pin
aroraavinash15-Dec-03 13:19
aroraavinash15-Dec-03 13:19 
GeneralRe: Network Monitoring Pin
David Crow16-Dec-03 2:29
David Crow16-Dec-03 2:29 
GeneralRe: Network Monitoring Pin
Chechi15-Dec-03 18:00
Chechi15-Dec-03 18:00 
GeneralRe: Network Monitoring Pin
Tom Wright15-Dec-03 11:38
Tom Wright15-Dec-03 11:38 
Generalbuild errors Pin
pankajdaga14-Dec-03 6:11
pankajdaga14-Dec-03 6:11 
Hi all,

I have the following situation: I have a MyDataSource.h and MyDataSource.cpp files that define and implement a simple C++ templated class:

// MyDataSource.h file
<code>
#ifndef _MYDATASOURCE_H
#define _MYDATASOURCE_H

template <class T>
class Test
{
public:
Test(T * source);
~Test();
void TestMethod();
private:
T* m_source;
};
#endif
</code>

// MyDataSource.cpp file
<code>
#include "MyDataSource.h"

template <class T>
Test::Test(T * source)
:m_source(source)
{}

template <class T>
Test::~Test()
{}

template <class T>
void Test::TestMethod()
{}
</code>

However, when I compile this. I get the following build errors that I have been unable to resolve.

i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(4): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(6): error C2244: 'Test<T>::__ctor' : unable to match function definition to an existing declaration
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(9): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(10): error C2244: 'Test<T>::~Test' : unable to match function definition to an existing declaration
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(13): error C2955: 'Test' : use of class template requires template argument list
i:\Thesis\Source Code\App\TemplateTests\MyDataSource.cpp(14): error C2244: 'Test<T>::TestMethod' : unable to match function definition to an existing declaration

However, if I put the implementation in the .h file, then everything compiles fine. What do I need to do to get rid of these errors?

Thanks,

Sincerely,

Xargon


Without struggle, there is no progress
GeneralRe: build errors Pin
Ian Darling14-Dec-03 7:06
Ian Darling14-Dec-03 7:06 
GeneralRe: build errors Pin
Steen Krogsgaard14-Dec-03 22:34
Steen Krogsgaard14-Dec-03 22:34 
GeneralRe: build errors Pin
Bo Hunter14-Dec-03 19:55
Bo Hunter14-Dec-03 19:55 
GeneralLinking MFC code with non MFC code Pin
debsbunny714-Dec-03 0:59
debsbunny714-Dec-03 0:59 
GeneralRe: Linking MFC code with non MFC code Pin
Mike Dimmick14-Dec-03 3:41
Mike Dimmick14-Dec-03 3:41 
GeneralRe: Linking MFC code with non MFC code Pin
debsbunny714-Dec-03 4:40
debsbunny714-Dec-03 4:40 
GeneralRe: Linking MFC code with non MFC code Pin
Mike Dimmick14-Dec-03 4:59
Mike Dimmick14-Dec-03 4:59 
GeneralRe: Linking MFC code with non MFC code Pin
debsbunny715-Dec-03 4:18
debsbunny715-Dec-03 4:18 
GeneralSource Safe Automation Question Pin
YaronNir13-Dec-03 21:10
YaronNir13-Dec-03 21:10 
QuestionHow can i hide some exe file? Pin
novachen13-Dec-03 20:17
novachen13-Dec-03 20:17 
AnswerRe: How can i hide some exe file? Pin
Antti Keskinen14-Dec-03 0:58
Antti Keskinen14-Dec-03 0:58 
AnswerRe: How can i hide some exe file? Pin
Mike Dimmick14-Dec-03 3:43
Mike Dimmick14-Dec-03 3:43 
AnswerRe: How can i hide some exe file? Pin
Terry O'Nolley14-Dec-03 12:02
Terry O'Nolley14-Dec-03 12:02 
GeneralTrouble in warp a function in COM dll Pin
novachen13-Dec-03 20:00
novachen13-Dec-03 20:00 
GeneralcontentEditable in div in C++ app no processing Enter Pin
Neville Franks13-Dec-03 17:44
Neville Franks13-Dec-03 17:44 
GeneralRe: contentEditable in div in C++ app no processing Enter Pin
alex.barylski24-Mar-04 23:18
alex.barylski24-Mar-04 23:18 
QuestionCFile Read questioN? Pin
Maverick13-Dec-03 16:36
Maverick13-Dec-03 16:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.