Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Multithreading problem in Win32

Multithreading problem in Win32

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dev578
    wrote on last edited by
    #1

    When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

    J G D 4 Replies Last reply
    0
    • D Dev578

      When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

      J Offline
      J Offline
      Joel Holdsworth
      wrote on last edited by
      #2

      AfxBeginThread is an MFC function. The function essentially wraps up the old C++ _beginthreadex function. If you're only using plain old Win32, you'll need to use this function instead. Joel Holdsworth

      1 Reply Last reply
      0
      • D Dev578

        When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

        G Offline
        G Offline
        Gary R Wheeler
        wrote on last edited by
        #3

        In addition to Joel's answer, you should also select for 'multi-threaded DLL' in the 'code generation' section of the project's C/C++ properties.


        Software Zen: delete this;

        1 Reply Last reply
        0
        • D Dev578

          When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

          J Offline
          J Offline
          Joel Holdsworth
          wrote on last edited by
          #4

          If you are using MFC, have you included afxmt.h in your stdafx.h file? Joel Holdsworth

          1 Reply Last reply
          0
          • D Dev578

            When I use AfxBeginThread in a Win32 application, I get this error: error C3861: 'AfxBeginThread': identifier not found, even with argument-dependent lookup Not found? When I type AfxBeginThread and then the ( , it lists the parameters for it. Any idea why it is doing this? Any help is appreciated. -Dev578

            D Offline
            D Offline
            Dev578
            wrote on last edited by
            #5

            I am trying to create the thread inside a class: class ThreadClass { public: //... bool StartThread(); DWORD WINAPI ThreadFunc( LPVOID lpParam ); //... }; bool ThreadClass::StartThread() { DWORD dwThreadId, dwThrdParam = 1; HANDLE hThread; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size ThreadFunc, // thread function &dwThrdParam, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier return true; } DWORD WINAPI ThreadClass::ThreadFunc( LPVOID lpParam ) { //do whatever here return 0; } this produces this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (LPVOID)' to 'LPTHREAD_START_ROUTINE' Any ideas why it is doing this / how to fix it? Any help is appreciated. -Dev578

            T 1 Reply Last reply
            0
            • D Dev578

              I am trying to create the thread inside a class: class ThreadClass { public: //... bool StartThread(); DWORD WINAPI ThreadFunc( LPVOID lpParam ); //... }; bool ThreadClass::StartThread() { DWORD dwThreadId, dwThrdParam = 1; HANDLE hThread; hThread = CreateThread( NULL, // default security attributes 0, // use default stack size ThreadFunc, // thread function &dwThrdParam, // argument to thread function 0, // use default creation flags &dwThreadId); // returns the thread identifier return true; } DWORD WINAPI ThreadClass::ThreadFunc( LPVOID lpParam ) { //do whatever here return 0; } this produces this error: error C2664: 'CreateThread' : cannot convert parameter 3 from 'DWORD (LPVOID)' to 'LPTHREAD_START_ROUTINE' Any ideas why it is doing this / how to fix it? Any help is appreciated. -Dev578

              T Offline
              T Offline
              Tim Smith
              wrote on last edited by
              #6

              Make ThreadFunc a static function. Tim Smith I'm going to patent thought. I have yet to see any prior art.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups