I have added two files on my existing mfc application a1.h &a1.cpp . I have function defintion in a1.cpp to read serially. This function iam calling in Scgenview::Ontimer() function in a thread . Below is the code Code: [B]a1.h [/B] int readserial(); Code: [B]a1.cpp[/B] #include "stdafx.h" #include"a1.h" readserial() { function defintion } Code: [B]Scgenview.cpp[/B] #include"a1.h" #include "stdafx.h" void CScenGenView::OnTimer(UINT_PTR nIDEvent) { LPVOID param= NULL; HANDLE GPS_READ = ::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)[B]readserial[/B](),(LPVOID) param, 0,NULL); } But i am getting a linker error which is listed below Code: Error 41 fatal error LNK1120: 1 unresolved externals Debug\ScenGen.exe ScenGen Error 40 error LNK2019: unresolved external symbol "int __cdecl readserial(void)" (?readserial@@YAHXZ) referenced in function "public: void __thiscall CScenGenView::OnTimer(unsigned int)" (?OnTimer@CScenGenView@@QAEXI@Z) ScenGenView.obj ScenGen
I don't know about the first error. Your second error is because the function signature for the thread proc is wrong. You need to declare readserial() like this: Code: DWORD WINAPI readserial(LPVOID lpParameter);