Development/C/C++
[_beginthreadex 형변환문제]
cyj4369
2011. 11. 22. 17:49
2003-01-09 오후 8:18:50 / 번호: 270644 |
category: VC++ 일반 / 조회: 167 |
|
[급질문]_beginthreadex 에서 BOOL 함수 호출..그리고 파라메터 |
|
|
리턴 값이 BOOL 인 함수를 쓰레드로 쓸려면 3번째 파라미터에 어떻게 선언해줘야되죠??
그리고 구조체를 파라미터로 넘길려고 그러는데..자꾸 이런에러가 뜨네요.
error C2664: '_beginthreadex' : cannot convert parameter 3 from 'unsigned int (struct st_ComPort *)' to 'unsigned int (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
어떻게 해야 되죠?? 파라미터를 넘겨야 되죠??
|
|
2004-10-15 오전 1:15:26 / 번호: 474101 / |
|
|
Re: _beginthreadex 형변환문제 답변. |
|
|
c++ 은 자료형을 엄격히 구분해서 발생하는 문제입니다.
(HANDLE)_beginthreadex(NULL, 0, ClientConn, (void*)clntSock, 0, (unsigned *)&dwThreadID);
요렇게 사용하면 당근 님이 묻는 Error가 발생합니다.
이것땜시 저도 아주 두시간을 헤맸어용...ㅜㅜ;
문제는 세번째 인자에 있습니다. 요걸 이렇게 바꾸면 형변환 문제 해결... 아래 에러 왕짜증..
error C2664: '_beginthreadex' : cannot convert parameter 3 from 'unsigned long (void *)' to 'unsigned int (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
음 그니까 (HANDLE)_beginthreadex(NULL, 0, (unsigned int(__stdcall*)(void*))ClientConn, (void*)clntSock, 0, (unsigned *)&dwThreadID);
위에걸 이렇게 바꿔주시면 해결 될거에요....^^
즐공하세용!!
출처 : 데브피아(http://www.devpia.com)
|
|