Click here to Skip to main content
15,914,225 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Measurement of Time Difference less than second? Pin
itkid21-Oct-05 12:18
itkid21-Oct-05 12:18 
GeneralRe: Measurement of Time Difference less than second? Pin
Indivara21-Oct-05 15:00
professionalIndivara21-Oct-05 15:00 
GeneralRe: Measurement of Time Difference less than second? Pin
Arman S.22-Oct-05 0:53
Arman S.22-Oct-05 0:53 
QuestionPrinting multiple views Pin
BuckBrown21-Oct-05 10:23
BuckBrown21-Oct-05 10:23 
QuestionDiscrete Cosine Transform - Image Processing Pin
Lampros Giampouras21-Oct-05 9:25
Lampros Giampouras21-Oct-05 9:25 
Questionembedded propertysheet in a dialogbar: how to make ON_UPDATE_COMMAND_UI work Pin
kylur21-Oct-05 8:53
kylur21-Oct-05 8:53 
AnswerRe: embedded propertysheet in a dialogbar: how to make ON_UPDATE_COMMAND_UI work Pin
Rage_bla21-Oct-05 10:15
Rage_bla21-Oct-05 10:15 
QuestionTemplates & error C2440 Pin
Rage_bla21-Oct-05 8:12
Rage_bla21-Oct-05 8:12 
I need some help. Here it the whole code snippet:

#include "stdafx.h"

template<typename T>
int IndirectFunction(int * pData)
{
return 0;
}
//also tried
//int __cdecl IndirectFunction(int * pData)
//{...}

typedef int (*ONEPARAMFUNCTION)(void* param);
//also tried
//typedef int (__cdecl *ONEPARAMFUNCTION)(void* param);

int main()
{
// <<<<<<<<<
//error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'ONEPARAMFUNCTION'
ONEPARAMFUNCTION t = (ONEPARAMFUNCTION) &IndirectFunction<int>;
// >>>>>>>>>

return 0;
}

How can I make it work ??
I tried googling a little - C2440 seems to be pretty "popular" but I didn't find anything that could help me.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/C2440.asp also didn't help Frown | :(



Seems it happens becouse of the template, if I remove it compiles ok (using only - int IndirectFunction(int * pData) without the template<>).

If I replace:
int IndirectFunction(int * pData)
with
int IndirectFunction(void * pData)
it compiles ok.

If I use templates and int* as parameter I get the error. Help!

-- modified at 14:22 Friday 21st October, 2005
AnswerRe: Templates &amp; error C2440 Pin
kylur21-Oct-05 9:11
kylur21-Oct-05 9:11 
GeneralRe: Templates &amp; error C2440 Pin
Rage_bla21-Oct-05 9:57
Rage_bla21-Oct-05 9:57 
GeneralRe: Templates &amp; error C2440 Pin
BadKarma21-Oct-05 12:24
BadKarma21-Oct-05 12:24 
QuestionRe: Templates &amp; error C2440 Pin
Rage_bla21-Oct-05 13:02
Rage_bla21-Oct-05 13:02 
AnswerRe: Templates &amp; error C2440 Pin
BadKarma21-Oct-05 22:30
BadKarma21-Oct-05 22:30 
GeneralRe: Templates &amp; error C2440 Pin
Rage_bla22-Oct-05 4:01
Rage_bla22-Oct-05 4:01 
QuestionSafe Language Pin
Ken Mazaika21-Oct-05 7:47
Ken Mazaika21-Oct-05 7:47 
AnswerRe: Safe Language Pin
Rage_bla21-Oct-05 7:54
Rage_bla21-Oct-05 7:54 
GeneralRe: Safe Language Pin
Ken Mazaika21-Oct-05 8:01
Ken Mazaika21-Oct-05 8:01 
GeneralRe: Safe Language Pin
bugDanny21-Oct-05 8:13
bugDanny21-Oct-05 8:13 
AnswerRe: Safe Language Pin
David Crow21-Oct-05 8:53
David Crow21-Oct-05 8:53 
QuestionPlease help me... (screen shot) Pin
NSoft21-Oct-05 7:33
NSoft21-Oct-05 7:33 
AnswerRe: Please help me... (screen shot) Pin
Rage_bla21-Oct-05 7:49
Rage_bla21-Oct-05 7:49 
AnswerRe: Please help me... (screen shot) Pin
bugDanny21-Oct-05 8:18
bugDanny21-Oct-05 8:18 
GeneralRe: Please help me... (screen shot) Pin
David Crow21-Oct-05 8:55
David Crow21-Oct-05 8:55 
QuestionVisual C++ 7.1 Subclassing Pin
Tom Moore21-Oct-05 7:05
Tom Moore21-Oct-05 7:05 
AnswerRe: Visual C++ 7.1 Subclassing Pin
Chris Losinger21-Oct-05 7:17
professionalChris Losinger21-Oct-05 7:17 

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.