Click here to Skip to main content
12,957,007 members (59,109 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 1-Oct-12 19:38pm
JOHN 602 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
Top Experts
Last 24hrsThis month
OriginalGriff 6,924
CHill60 3,550
Maciej Los 3,312
ppolymorphe 2,120
Jochen Arndt 1,973

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 2 Oct 2012
Copyright © CodeProject, 1999-2017
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