CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: multithread

  1. #1
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    47

    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.....

  2. #2
    Join Date
    Dec 2002
    Posts
    287
    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

  3. #3
    Join Date
    Jan 2003
    Location
    Italy
    Posts
    47
    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!!!

  4. #4
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    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--

  5. #5
    Join Date
    Jul 1999
    Location
    Israel
    Posts
    1,793
    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

  6. #6
    Join Date
    Feb 2002
    Posts
    5,757
    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
  •  





Click Here to Expand Forum to Full Width

Featured