API function won't compile using CYGWIN g++; Interpreting error message

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roger Sherman

    #1

    API function won't compile using CYGWIN g++; Interpreting error message

    I'm using CYGWIN g++. I'm having trouble making an API call the
    WindowFromPoint function.
    Here is my code.


    FILE: t.cc
    #include <windows.h>
    int main () {

    POINT p;
    p.x=200;
    p.y=200;

    HWND window_handle;

    window_handle = WindowFromPoint (p);

    return 0;
    }


    Here is the error message I'm getting:

    C:\DOCUME~1\jef f\LOCALS~1\Temp \ccIIB5F0.o(.te xt+0x22):t.cc: undefined
    reference to 'WindowFromPoin t@8'

    Could someone please tell me
    1)What this error means, specifically, and;

    2)What I need to do to fix it

    Thank you
    Jeff
  • Barry Schwarz

    #2
    Re: API function won't compile using CYGWIN g++; Interpreting error message

    On 31 Jan 2004 13:01:03 -0800, halusa@erols.co m (Roger Sherman) wrote:
    [color=blue]
    >I'm using CYGWIN g++. I'm having trouble making an API call the
    >WindowFromPoin t function.
    >Here is my code.
    >
    >
    >FILE: t.cc
    >#include <windows.h>
    >int main () {
    >
    >POINT p;
    >p.x=200;
    >p.y=200;
    >
    >HWND window_handle;
    >
    >window_handl e = WindowFromPoint (p);
    >
    >return 0;
    >}
    >
    >
    >Here is the error message I'm getting:
    >
    >C:\DOCUME~1\je ff\LOCALS~1\Tem p\ccIIB5F0.o(.t ext+0x22):t.cc: undefined
    >reference to 'WindowFromPoin t@8'
    >
    >Could someone please tell me
    >1)What this error means, specifically, and;
    >
    >2)What I need to do to fix it
    >
    >Thank you
    >Jeff[/color]
    See the answers you get to the same question in
    alt.comp.lang.l earn.c-c++. If you must post to multiple groups, do it
    with a single message, not an individual one to each group.


    <<Remove the del for email>>

    Comment

    • Régis Troadec

      #3
      Re: API function won't compile using CYGWIN g++; Interpreting error message

      Hello,

      "Roger Sherman" <halusa@erols.c om> a écrit dans le message de news:
      5c798e4c.040131 1301.421de32b@p osting.google.c om...[color=blue]
      > I'm using CYGWIN g++. I'm having trouble making an API call the
      > WindowFromPoint function.
      > Here is my code.
      >
      >
      > FILE: t.cc
      > #include <windows.h>
      > int main () {
      >
      > POINT p;
      > p.x=200;
      > p.y=200;
      >
      > HWND window_handle;
      >
      > window_handle = WindowFromPoint (p);
      >
      > return 0;
      > }
      >
      >
      > Here is the error message I'm getting:
      >
      > C:\DOCUME~1\jef f\LOCALS~1\Temp \ccIIB5F0.o(.te xt+0x22):t.cc: undefined
      > reference to 'WindowFromPoin t@8'
      >
      > Could someone please tell me
      > 1)What this error means, specifically, and;[/color]

      Although it's not a C problem as it's commonly discussed here, I *can* think
      it's a linkage problem.
      The linker can't resolve this name (WindowFromPoin t) because you didn't
      specify to your linker the library in which this function is stored.
      [color=blue]
      > 2)What I need to do to fix it[/color]

      You need to link your program with user32.lib

      best regards, regis


      Comment

      • CBFalconer

        #4
        Re: API function won't compile using CYGWIN g++; Interpreting errormessage

        Roger Sherman wrote:[color=blue]
        >
        > I'm using CYGWIN g++. I'm having trouble making an API call the
        > WindowFromPoint function.
        > Here is my code.
        >
        > FILE: t.cc[/color]

        sounds like a C++, not C program.
        [color=blue]
        > #include <windows.h>[/color]

        definitely non-standard header.
        [color=blue]
        > int main () {
        >
        > POINT p;[/color]

        undefined type POINT
        [color=blue]
        > p.x=200;
        > p.y=200;
        >
        > HWND window_handle;[/color]

        Undefined type HWND. declaring variable after executable code.
        [color=blue]
        >
        > window_handle = WindowFromPoint (p);[/color]

        Undeclared function.
        [color=blue]
        >
        > return 0;
        > }
        >
        >
        > Here is the error message I'm getting:
        >
        > C:\DOCUME~1\jef f\LOCALS~1\Temp \ccIIB5F0.o(.te xt+0x22):t.cc: undefined
        > reference to 'WindowFromPoin t@8'[/color]

        Now we know you are using a C++ compiler. Off topic on c.l.c
        [color=blue]
        >
        > Could someone please tell me
        > 1)What this error means, specifically, and;
        >
        > 2)What I need to do to fix it[/color]

        Get thee to a newsgroup where this is topical. The windows
        contamination means c.l.c++ is not it. That, and the c++ code,
        means c.l.c is not it. Maybe you should look for a group with the
        word 'windows' in it.

        --
        Chuck F (cbfalconer@yah oo.com) (cbfalconer@wor ldnet.att.net)
        Available for consulting/temporary embedded and systems.
        <http://cbfalconer.home .att.net> USE worldnet address!


        Comment

        Working...