sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Roger Sherman's Avatar

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


Question posted by: Roger Sherman (Guest) on November 14th, 2005 02:26 AM
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\jeff\LOCALS~1\Temp\ccIIB5F0.o(.text+0x 22):t.cc: undefined
reference to 'WindowFromPoint@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
3 Answers Posted
Barry Schwarz's Avatar
Guest - n/a Posts
#2: Re: API function won't compile using CYGWIN g++; Interpreting error message

On 31 Jan 2004 13:01:03 -0800, Join Bytes! (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
>#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\jeff\LOCALS~1\Temp\ccIIB5F0.o(.text+0x 22):t.cc: undefined
>reference to 'WindowFromPoint@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.learn.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>>
Régis Troadec's Avatar
Guest - n/a Posts
#3: Re: API function won't compile using CYGWIN g++; Interpreting error message

Hello,

"Roger Sherman" <halusa@erols.com> a écrit dans le message de news:
Join Bytes!...[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\jeff\LOCALS~1\Temp\ccIIB5F0.o(.text+0x 22):t.cc: undefined
> reference to 'WindowFromPoint@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 (WindowFromPoint) 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


CBFalconer's Avatar
Guest - n/a Posts
#4: Re: API function won't compile using CYGWIN g++; Interpreting error message

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\jeff\LOCALS~1\Temp\ccIIB5F0.o(.text+0x 22):t.cc: undefined
> reference to 'WindowFromPoint@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@yahoo.com) (cbfalconer@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!


 
Not the answer you were looking for? Post your question . . .
196,842 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,842 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors