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

Global Function

Scheduled Pinned Locked Moved C / C++ / MFC
helpcsharpc++tutorialquestion
2 Posts 2 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.
  • S Offline
    S Offline
    Static x
    wrote on last edited by
    #1

    Hi Everybody, I have problem with global functions in VC++.Net, is simply add a global function in my project like: UINT MyThreadProc(LPVOID pParam) { ... return 0; } and then when i want to call it for example when pressing abutton : AfxBeginThread(MyThreadProc,0) , i get an error : c:...: error C2065: 'MyThreadProc' : undeclared identifier can anyone help ? Regards Giorgi Moniava

    PJ ArendsP 1 Reply Last reply
    0
    • S Static x

      Hi Everybody, I have problem with global functions in VC++.Net, is simply add a global function in my project like: UINT MyThreadProc(LPVOID pParam) { ... return 0; } and then when i want to call it for example when pressing abutton : AfxBeginThread(MyThreadProc,0) , i get an error : c:...: error C2065: 'MyThreadProc' : undeclared identifier can anyone help ? Regards Giorgi Moniava

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      When the compiler compiles a cpp file it starts at the top and works it's way down. If it finds an identifier (variable or function) that was not declared in a line above the current line it will generate this error. What you have to do is either insert a forward declaration of your function at the top of your cpp file (header files are a good way to do this), or move your function to a point in the file before the line that caused the error.


      "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!


      Honoured as one of The Most Helpful Members of 2004

      Within you lies the power for good; Use it!

      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