Thread function issue

I the following error when compiling the below code...

'&' : illegal operation on bound member function expression

The error refers to the call to create a thread running functionX.

Any ideas? I did try CreateThread(NULL,0,&pkg::functionX,NULL, 0, 0); but no joy.

Thanks!

pkg.h
1
2
3
4
5
6
7
8
9
10
11

#include "stdafx.h"
#include <windows.h>

class Pkg
{

public :
	void functionY();
	DWORD WINAPI functionX(void*);
};



pkg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "stdafx.h"
#include "Pkg.h"

DWORD WINAPI functionX(void*);


	DWORD WINAPI Pkg::functionX(void*){
		return 0;
	}

	void Pkg::functionY() {
		CreateThread(NULL,0,&functionX,NULL, 0, 0);
	}
Last edited on
Someone correct me if I'm wrong as I'm fairly new to programming and haven't studied threading, but I don't think you can get the address of a function. Either that or you will need to include the () at the end if it.
Last edited on
It is possible as this was fine until I created the header and made the functions part of the pkg class. I tried adding the () but this did not work thanks.
Last edited on
Topic archived. No new replies allowed.