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