Connecting Tech Pros Worldwide Help | Site Map

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

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 14th, 2005, 01:26 AM
Roger Sherman
Guest
 
Posts: n/a
Default 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\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

  #2  
Old November 14th, 2005, 01:26 AM
Barry Schwarz
Guest
 
Posts: n/a
Default Re: API function won't compile using CYGWIN g++; Interpreting error message

On 31 Jan 2004 13:01:03 -0800, halusa@erols.com (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+0 x22):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>>
  #3  
Old November 14th, 2005, 01:26 AM
Régis Troadec
Guest
 
Posts: n/a
Default 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:
5c798e4c.0401311301.421de32b@posting.google.com...[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


  #4  
Old November 14th, 2005, 01:27 AM
CBFalconer
Guest
 
Posts: n/a
Default 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\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!


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

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 220,662 network members.