linker errors in VS 2005 (C++)
- I fixed the "cant find windows.h" problem and now I am getting linker erros like those below, after using the Windows App wizard to create code and compile it with no changes, can anyone help?
Linking...
test4.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageW@4 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__TranslateAcceleratorW@12 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__GetMessageW@16 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__LoadAcceleratorsW@8 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__LoadStringW@16 referenced in function _wWinMain@16
test4.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExW@4 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__LoadCursorW@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__LoadIconW@8 referenced in function "unsigned short __cdecl MyRegisterClass(struct HINSTANCE__ *)" (?MyRegisterClass@@YAGPAUHINSTANCE__@@@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExW@48 referenced in function "int __cdecl InitInstance(struct HINSTANCE__ *,int)" (?InitInstance@@YAHPAUHINSTANCE__@@H@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__EndPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__BeginPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcW@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__DestroyWindow@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__DialogBoxParamW@20 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
test4.obj : error LNK2019: unresolved external symbol __imp__EndDialog@8 referenced in function "int __stdcall About(struct HWND__ *,unsigned int,unsigned int,long)" (?About@@YGHPAUHWND__@@IIJ@Z)
Answers
- Hi,
I had the same problem at first, but luckily I could solve it. The problem is that the default installation of VS 8 express doesn't support the Platform SDK, so, after installing the platform SDK, you need to make a few modifications...
1. Update the corewin_express.vsprops file (NOT the corewin.vsprops file).
You need to change this...
AdditionalDependencies="kernel32.lib"
to this
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
2. Enable Win32 application creation
Change the file AppSettings.htm found at
“%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\"
comment lines 441-> 444
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;
Now, everything should be fine (when you need to create a new win32 project, choose a win32 console application, and in the advancded settings choose win32 application)
This information was found in MSDN. You can find the full article here...
http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx
All Replies
- You are probably missing a library that you need to link to (user32.dll). The PSDK folks should be able to help.
Thanks,
Ayman Shoukry
VC++ Team - Should that lib be in a specific directory, I did a search and it is located in WINDOWS/System32? Is there a newer version of the file possibly? VS 6 compiles the same code just fine.
- Are any PSDK guys out there...

This problem is holding up my project and is getting very frustrating?
Thanks
- Did you installed a Platform SDK?
What Visual Studio do you use? Th express version does not include the Platform SDK! - I followed the instructions on MSDN for installing the PSDK. I have VS 8 express. The instructions said I could install the PSDK and change some setting and WIN 32 apps could be built, currently I can not build them and I get linker errors.
Is it not true that WIN 32 apps work with the PSDK as stated on teh web page?
Thanks - Hi,
I had the same problem at first, but luckily I could solve it. The problem is that the default installation of VS 8 express doesn't support the Platform SDK, so, after installing the platform SDK, you need to make a few modifications...
1. Update the corewin_express.vsprops file (NOT the corewin.vsprops file).
You need to change this...
AdditionalDependencies="kernel32.lib"
to this
AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"
2. Enable Win32 application creation
Change the file AppSettings.htm found at
“%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\"
comment lines 441-> 444
// WIN_APP.disabled = true;
// WIN_APP_LABEL.disabled = true;
// DLL_APP.disabled = true;
// DLL_APP_LABEL.disabled = true;
Now, everything should be fine (when you need to create a new win32 project, choose a win32 console application, and in the advancded settings choose win32 application)
This information was found in MSDN. You can find the full article here...
http://lab.msdn.microsoft.com/express/visualc/usingpsdk/default.aspx - Thanks a lot, my problem was the
wrong corewin file, the MSDN post I read said the corewin.vsprops file was the one to change. I am getting the same linker errors even though I have made the required changes.
The difference is that after using the wizard to build a Debug test app I modified the project properties to use MFC in a shared DLL as follows:Project > Test properties > Configuration properties > General > Use of MFC > Use MFC in a shared DLL
(Note that before changing the above setting the project built without a problem.)
- I just added the .lib files to the project properties linker command line additional: and recompiled my win32 app. It compiles now that I have the additional libs added where before it would not compile under vc8
Bingo! That's it, it worked fine for me, Thanks.
Marc

Neuronz wrote: Project > Test properties > Configuration properties > General > Use of MFC > Use MFC in a shared DLL
I was having the following LNK2019 error in a project I was upgrading from Visual Studio 6:
NWNXSCORCO.obj : error LNK2019: unresolved external symbol __imp__StringFromGUID2@12 referenced in function "protected: void __thiscall CNWNXSCORCO::GenUUID(char *)" (?GenUUID@CNWNXSCORCO@@IAEXPAD@Z)
NWNXSCORCO.obj : error LNK2019: unresolved external symbol __imp__CoCreateGuid@4 referenced in function "protected: void __thiscall CNWNXSCORCO::GenUUID(char *)" (?GenUUID@CNWNXSCORCO@@IAEXPAD@Z)
I have spent hours trying to figure out the problem today. I saw your post and tried it. It didn't work for me, but then I noticed the option below that said 'Use of ATL' and it was set to 'Not using ATL'. I changed this to 'Dynamic Link to ATL', and voila!
Project -> [Proj Name] Properties -> Configuration properties -> General -> Use of ATL -> Dynamic Link to ATL
This solved my LNK2019 linking problems!
Thanks,
Doug- This post saved me i spent hours looking for a solution until i read this and realised i'd altered the wrong file thanks - brilliant :)
- It solved my problems too.
I'll make something to automate this task. - Yes, the MS tech page had me edit the wrong file. I guess most of us did. But thanks, this fixed my problem.
I had the same linker problem and solved it.
Now, I got this when building the solution
(yes I followed all the steps of http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/. Using Vista OS and installed PSDK for Vista). The same solution works in VS 6.
1>------ Build started: Project: MasterGoal, Configuration: Debug Win32 ------
1>Compiling...
1>icl.cpp
1>Compiling UNICODE version
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(101) : warning C4996: 'ultoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(824) : see declaration of 'ultoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ultoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(124) : warning C4996: 'itoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(820) : see declaration of 'itoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(147) : warning C4996: 'ultoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(824) : see declaration of 'ultoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ultoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(182) : warning C4996: '_ultow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(884) : see declaration of '_ultow'
1> Message: 'This function or variable may be unsafe. Consider using _ultow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(198) : warning C4996: '_itow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(878) : see declaration of '_itow'
1> Message: 'This function or variable may be unsafe. Consider using _itow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(214) : warning C4996: '_ultow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(884) : see declaration of '_ultow'
1> Message: 'This function or variable may be unsafe. Consider using _ultow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>Compiling...
1>icl_win.cpp
1>Compiling UNICODE version
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(101) : warning C4996: 'ultoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(824) : see declaration of 'ultoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ultoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(124) : warning C4996: 'itoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(820) : see declaration of 'itoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _itoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(147) : warning C4996: 'ultoa' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\stdlib.h(824) : see declaration of 'ultoa'
1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _ultoa. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(182) : warning C4996: '_ultow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(884) : see declaration of '_ultow'
1> Message: 'This function or variable may be unsafe. Consider using _ultow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(198) : warning C4996: '_itow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(878) : see declaration of '_itow'
1> Message: 'This function or variable may be unsafe. Consider using _itow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>d:\documentos\proyectos\mastergoal\framework\mastergoal-solution\src\icl_lib\icl_string.h(214) : warning C4996: '_ultow' was declared deprecated
1> C:\Program Files\Microsoft Visual Studio 8\VC\include\wchar.h(884) : see declaration of '_ultow'
1> Message: 'This function or variable may be unsafe. Consider using _ultow_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
1>..\icl_lib\win\icl_win.cpp(189) : error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'ATOM [2]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://d:\Documentos\Proyectos\Mastergoal\Framework\mastergoal-solution\tmp\mastergoal.d\BuildLog.htm"
1>MasterGoal - 1 error(s), 12 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any ideas? Thanks and regards.I solved the warning issue, now I get only this error:
1>------ Build started: Project: MasterGoal, Configuration: Debug Win32 ------
1>Compiling...
1>icl_win.cpp
1>Compiling UNICODE version
1>..\icl_lib\win\icl_win.cpp(189) : error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'ATOM [2]' to 'LPCWSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://d:\Documentos\Proyectos\Mastergoal\Framework\mastergoal-solution\tmp\mastergoal.d\BuildLog.htm"
1>MasterGoal - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

