I am just beginning learn C++, and I need to find the process ID of a program. I just learned about functions, and I am trying this out. I finally got all of my errors gone, and a new one popped up.
I haven't got a clue to what this is, and google didn't help either. Please help me figure out what is happening.
undefined reference to `GetProcessId(void*)@4'
I would assume that it means that there is no prototype of GetProcessId, but I really need help.
I am only a couple days into learning this awesome stuff, and that made no sense to me. For my purposes it will do, as I am after a task and not the understanding of this specific code. Thanks for posting, I will hopefully learn to understand it soon.
Note that GetProcessId is a WinAPI function. On other systems, you'd have to use different functions.
So when you have more WinAPI-related questions, you should post in the Windows programming subforum.
You shouldn't declare WinAPI functions yourselves, instead you should make sure the correct header is included. windows.h already does that, however GetProcessId was not available in old versions of Windows, so you need to explicitly specify that you want to use those newer functions. You can do that by defining a global macro or manually for each file by adding the line #define _WIN32_WINNT 0x501 before including windows.h. That would let you use all functions that were available in Windows XP and before. See here for other possible values: http://msdn.microsoft.com/en-us/library/6sehtctf.aspx