Menu

EndTask() error

Sevko
2009-03-08
2012-09-26
  • Sevko

    Sevko - 2009-03-08

    This code (run from console) returns an error :

    main.cpp In function int main(int, char**)': main.cppEndTask' undeclared (first use this function)
    (Each undeclared identifier is reported only once for each function it appears in.)
    Makefile.win [Build Error] [main.o] Error 1

    include <cstdlib>

    include <iostream>

    include <Windows.h>

    using namespace std;

    int main(int argc, char *argv[])
    {
    HWND hWnd;
    bool fShutDown;
    bool fForce;

    fShutDown = false;
    fForce = true;  
    hWnd = FindWindow(NULL, &quot;Calculator&quot;);
    
    EndTask(hWnd, fShutDown,  fForce);
    
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
    

    }

     
    • cpns

      cpns - 2009-03-09

      MSDN also says "Minimum operating systems: Windows 2000". You may need to set the version macro to enable this function in the <windows.h> header file.

      Find the function in the <winuser.h> header file and check what version macro value it is dependent on and set that using a -D<macro>=<value> command line option.

      Version macros are described at http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx I suspect that you need: -DWINVER=0x0500 or -D_WIN32_WINNT=0x0500. I seem to recall that the MinGW Win32 headers define these as 0x0400 by default.

      Don't put your project on the Desktop. A bad idea in any case - (your desktop may get littered with temporary and intermediate build files), but also the path "C:\Documents and Settings\Sevko\Desktop\&quot; contains spaces which can screw up your build in unpredictable ways.

      Clifford

       
    • Sevko

      Sevko - 2009-03-08

      Can you tell me what I did wrong?

       
    • Wayne Keen

      Wayne Keen - 2009-03-08

      A couple of questions:

      (1) Isn't that supposed to be windows.h, not Windows.h

      (2) Is windows.h really the header you expect to contain EndTask

      Also,

      PLEASE do not excerpt the error messages, post the compile log from the beginning.

      Wayne

       
    • Sevko

      Sevko - 2009-03-09

      (1) Tried both

      (2) MSDN says: Header Declared in Winuser.h, include Windows.h it says the same for SetWindowText and it works white the same code if i replace EndTask with SetWindowText()

      and before the Main.cpp there's only the path and one line: 17 C:\Documents and Settings\Sevko\Desktop\main.cpp `EndTask' undeclared (first use this function)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.