### Author Topic: undefined reference once again  (Read 2541 times)

#### footprint

• Single posting newcomer
• Posts: 3
##### undefined reference once again
« on: May 25, 2006, 05:20:14 pm »
Hi,

I've searched the forum for similar problem, but I didn't find answer. How it looks: I am trying to compile a simple dll project, where on DLL_PROCESS_ATTACH event is set such a code:

hhookKeyb = SetWindowHookEx(WH_KEYBOARD, KeyboardProc, hinstDLL, 0);

And my dll doesn't compile, because of... here is build log:

Creating library file: libtestowe_dll.a
.objs\main.o:main.c:(.text+0x15b): undefined reference to `SetWindowHookEx'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

What's wrong with that?

#### thomas

• Lives here!
• Posts: 3979
##### Re: undefined reference once again
« Reply #1 on: May 25, 2006, 05:42:03 pm »
First, I wonder you even manage to compile this program in the first place, since it is SetWindowsHookEx, not SetWindowHookEx.

Second, it is not SetWindowsHookEx but either SetWindowsHookExA or SetWindowsHookExW, depending on whether or not you use Unicode. This is normally handled by a macro (SetWindowsHookEx resolves to either the ANSI or Unicode version). If that is not the case, then your Windows headers must be screwed up.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

#### footprint

• Single posting newcomer
• Posts: 3
##### Re: undefined reference once again
« Reply #2 on: May 25, 2006, 06:05:07 pm »
aaaargh.....  sorry, my fault!