Click here to Skip to main content
Rate this: bad
good
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
2ndary.h
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;
dialog=(C2ndary*)pParam;
dialog->a();
return 1;
}
 
void CMaindlg::OnClickedButton1()
{
thread1=AfxBeginThread(MyThreadA,this);
}
 
thanks,
 
rgds
 
illm1995
Posted 1-Oct-12 17:53pm
Edited 1-Oct-12 20:38pm
v6
Comments
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 520
1 Maciej Los 290
2 Richard MacCutchan 265
3 BillWoodruff 265
4 Suraj Sahoo | Coding Passion 155
0 OriginalGriff 8,764
1 Sergey Alexandrovich Kryukov 7,437
2 DamithSL 5,639
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


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