User forums > Using Code::Blocks

undefined reference once again

(1/1)

footprint:
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:

Linking dynamic library: testowe_dll.dll
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:
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.

footprint:
aaaargh.....  sorry, my fault!

Navigation

[0] Message Index

Go to full version