Click here to Skip to main content
11,791,025 members (52,132 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: MFC
Hi and good morning to all the user of code project,
i try to link my thread from other cpp file to the main cpp, but it show an error message, as show as below,

>AutoModeDlg.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl MyThreadA(void *)" (?MyThreadA@@YAIPAX@Z) referenced in function "public: void __thiscall CAutoModeDlg::OnBnClickedButton3(void)" (?OnBnClickedButton3@CAutoModeDlg@@QAEXXZ)
1>AutoModeDlg.obj : error LNK2019: unresolved external symbol "unsigned int __cdecl MyThreadB(void *)" (?MyThreadB@@YAIPAX@Z) referenced in function "public: void __thiscall CAutoModeDlg::OnBnClickedButton4(void)" (?OnBnClickedButton4@CAutoModeDlg@@QAEXXZ)
1>C:\Users\Noldx\documents\visual studio 2010\Projects\2NDTASK\Debug\2NDTASK.exe : fatal error LNK1120: 2 unresolved externals

here is the part of the sample code

in my secondary .cpp file
static UINT MyThreadA(LPVOID pParam);
int a();
2ndary .cpp
int C2ndary::a()
//command of thread
return 0;
main cpp's header
CWinThread* thread1;
main cpp
#include "2ndary.h"

extern UINT MyThreadA(LPVOID pParam);//call back the static UINT MyThreadA(LPVOID //pParam) that i declared in the 2ndary.h

// bla bla bla

UINT C2ndary::MyThreadA(LPVOID pParam)
C2ndary* dialog;
return 1;
void CMaindlg::OnClickedButton1()



Posted 1-Oct-12 16:53pm
Edited 1-Oct-12 19:38pm
JOHN 602 at 2-Oct-12 16:45pm
Hey bro
I be quite honest with you didn't go into the heart of you code. But as I know one of the proved method to communicate between the processes - using Pipes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 1,329
1 Maciej Los 835
2 ppolymorphe 780
3 KrunalRohit 686
4 CPallini 661

Advertise | Privacy | Mobile
Web02 | 2.8.1509028.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100