error LNK2028: unresolved token (trying to attach an existing window)  
Author Message
AliiZ





PostPosted: Visual C++ Language, error LNK2028: unresolved token (trying to attach an existing window) Top

Hi!

I'm trying to use the FindWindow() function, but it doesn't seem to work properly.
My whole program works just fine, but as soon as i add this piece of code, i
get these weird compiler errors.

code:
static char* fWndSTATIC = "FLYFF";
HWND fWindow = FindWindow(NULL, LPCWSTR(fWndSTATIC));

returning error when compiling:
Error 1 error LNK2028: unresolved token (0A000013) "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" ( FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "private: void __clrcall FlyFFINCAPro::Form1::activateINCAToolStripMenuItem_Click(class System::Object ^,class System::EventArgs ^)" ( activateINCAToolStripMenuItem_Click@Form1@FlyFFINCAPro@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) FlyFF INCA Pro.obj

Error 2 error LNK2019: unresolved external symbol "extern "C" struct HWND__ * __stdcall FindWindowW(wchar_t const *,wchar_t const *)" ( FindWindowW@@$$J18YGPAUHWND__@@PB_W0@Z) referenced in function "private: void __clrcall FlyFFINCAPro::Form1::activateINCAToolStripMenuItem_Click(class System::Object ^,class System::EventArgs ^)" ( activateINCAToolStripMenuItem_Click@Form1@FlyFFINCAPro@@$$FA$AAMXP$AAVObject@System@@P$AAVEventArgs@4@@Z) FlyFF INCA Pro.obj

Error 3 fatal error LNK1120: 2 unresolved externals

I'm using Visual Studio 2005. Standard IDE.



Visual C++14  
 
 
AliiZ





PostPosted: Visual C++ Language, error LNK2028: unresolved token (trying to attach an existing window) Top

Fixed.

I added:
#pragma comment(lib, "User32.lib")
under:
#include <windows.h>

But now, the program doesn't find the FLYFF window even while its running.


 
 
Brian Kramer





PostPosted: Visual C++ Language, error LNK2028: unresolved token (trying to attach an existing window) Top

This is an off-topic post. Please reserve your questions in this forum to C++ language issues only.