I was making a Windows application but I get an issue. When I try to extern a function with HWND as a parameter, the linker report an error:
undefined symbol void far htest( HWND__ const near * )
I'm using Win16 and not Win32 at this time, so the code is going to be 16-bit.
test.cpp:
#define STRICT
#include <windows.h>
#include <afxext.h>
#include <stdio.h>
#include "test2.h"
LRESULT CALLBACK MainWndProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
htest(hwnd);
}
test2.h:
extern void htest(HWND hwnd);
test2.cpp:
#include <windows.h>
void htest(HWND hwnd)
{
/* code here */
}
It looks like the issue comes from defining STRICT. When I looked in the win16.h header, which declares HWND, it checks for STRICT which I defined in test.cpp. If STRICT is not defined, HWND is declared as UINT. But if it is defined, HWND is declared as a structure.
For the solution, I added #define STRICT to test2.cpp.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With