-
February 3rd, 2003, 11:16 AM
#1
multithread
I must create a new thread with the _beginthread function (i can't use MFC).
Here i create it....
case WM_INITDIALOG:
SendDlgItemMessage(hDlg,IDC_PROG,PBM_SETRANGE,0,1000);
SendDlgItemMessage(hDlg,IDC_PROG,PBM_SETSTEP,1,0);
_beginthread (progr,0,NULL);
and this is the function called...
void progr(void *dummy){
[...code...]
}
Compiling there is no errors but in linking...the following error appears...
libcimtd.lib(streamb.obj) : error LNK2001: unresolved external symbol "void * __cdecl operator new(unsigned int,int,char const *,int)" (??2@YAPAXIHPBDH@Z)
What could be the reason????
I've included the option for multithread compiling /MT in the options and included the libcmt library....i don't find a solution.....
-
February 3rd, 2003, 11:27 AM
#2
The linker error doesn't seem to be related to the _beginthread itself. I think it is something introduced by the newly added code from progr. Can you please post the progr function code ?
Thanks,
Dan
-
February 3rd, 2003, 11:35 AM
#3
void progr(void *dummy){
int k=1;
char linea[20000];
ifstream prova ("sipers.txt",ios::in | ios::binary);
ofstream sipout ("sip.out",ios:ut | ios::binary);
while (!(prova.eof())){
prova.getline (linea,20000);
sipout.write (linea,strlen(linea));
SendDlgItemMessage(hdlgglob,IDC_PROG,PBM_STEPIT,0,0);
}
}
It's only a testing code to test the progress bar...i'm trying to use it!!!
-
February 3rd, 2003, 11:53 AM
#4
I've included the option for multithread compiling /MT in the options and included the libcmt library....i don't find a solution.....
The best I can tell is that "libcimtd.lib" can't find the new operator.
I generated a project (Win32, no MFC) and compiled most of your code snippit (MT, debug), except for the SendDlgItemMessage(hdlgglob,IDC_PROG,PBM_STEPIT,
0,0); statment
These are the libraries used:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
and these are the compiler opts:
/nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Fp"Debug/Multithread.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
NOTE that it's /MTd...
bytz
--This signature left intentionally blank--
-
February 3rd, 2003, 02:51 PM
#5
Try going to your project settings ( menu->setttings )
go to C/C++ tab
in the category combo select Code Generation
And in the Use Run-time library combo
select Debug mulithreaded.
that should do the trick...
HTH
kishk
-
February 3rd, 2003, 03:35 PM
#6
C++ multithread library including _beginthread() and _beginthreadex() require the process library.
#include <process.h>
Kuphryn
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|