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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Can't compile thread

Can't compile thread

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
4 Posts 3 Posters 1 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.
  • B Offline
    B Offline
    BoudewijnEctor
    wrote on last edited by
    #1

    Hi there, I've downloaded a tutorial from thecodeproject about tcp servers, and it contains the following code: int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; cout << "Press ESCAPE to terminate program\r\n"; AfxBeginThread(ServerThread,0); while(_getch()!=27); return nRetCode; } and this UINT ServerThread(LPVOID pParam) { //lots of other code return 0; } I've copied the code into a neat console app with mfc functionality, but this isn't compiling. How is this possible?

    M 1 Reply Last reply
    0
    • B BoudewijnEctor

      Hi there, I've downloaded a tutorial from thecodeproject about tcp servers, and it contains the following code: int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; cout << "Press ESCAPE to terminate program\r\n"; AfxBeginThread(ServerThread,0); while(_getch()!=27); return nRetCode; } and this UINT ServerThread(LPVOID pParam) { //lots of other code return 0; } I've copied the code into a neat console app with mfc functionality, but this isn't compiling. How is this possible?

      M Offline
      M Offline
      Michael P Butler
      wrote on last edited by
      #2

      BoudewijnEctor wrote: I've copied the code into a neat console app with mfc functionality, but this isn't compiling. What error do you get? Have you defined UINT ServerThread(LPVOID pParam) before the call to AfxBeginThread? Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space

      B 1 Reply Last reply
      0
      • M Michael P Butler

        BoudewijnEctor wrote: I've copied the code into a neat console app with mfc functionality, but this isn't compiling. What error do you get? Have you defined UINT ServerThread(LPVOID pParam) before the call to AfxBeginThread? Michael 'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space

        B Offline
        B Offline
        BoudewijnEctor
        wrote on last edited by
        #3

        Do I hvae to define ServerThread before it's call (I'm not used to that)? I'll try it, and if it works thank you a lot!!!:-D

        D 1 Reply Last reply
        0
        • B BoudewijnEctor

          Do I hvae to define ServerThread before it's call (I'm not used to that)? I'll try it, and if it works thank you a lot!!!:-D

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          BoudewijnEctor wrote: Do I hvae to define ServerThread before it's call (I'm not used to that)? No, but you do have to declare it.


          Five birds are sitting on a fence. Three of them decide to fly off. How many are left?

          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