[cfe-dev] Linker errors while building windows executable.

Michael Morris morrimichael at gmail.com
Mon Mar 7 20:04:26 PST 2011


I've successfully compiled Clang using Visual Studio Express 2010 ,
and can compile
and run Hello, World! using Clang on the Visual Studio Command Prompt.
But, when I
try and compile a simple windows program (source attached), I get these errors.

cc-000000.o : error LNK2019: unresolved external symbol __imp__LoadIconA at 8 refer
enced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__LoadCursorA at 8 ref
erenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__GetStockObject at 4
referenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__RegisterClassExA@
4 referenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__CreateWindowExA at 4
8 referenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__ShowWindow at 8 refe
renced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__UpdateWindow at 4 re
ferenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__GetMessageA at 16 re
ferenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__TranslateMessage@
4 referenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__DispatchMessageA@
4 referenced in function _WinMain at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__BeginPaint at 8 refe
renced in function _WndProc at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__TextOutA at 20 refer
enced in function _WndProc at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__EndPaint at 8 refere
nced in function _WndProc at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__PostQuitMessage at 4
 referenced in function _WndProc at 16
cc-000000.o : error LNK2019: unresolved external symbol __imp__DefWindowProcA at 16
 referenced in function _WndProc at 16
a.out : fatal error LNK1120: 15 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocatio
n)

No matter what options I pass through with -Xlinker LINK can't find
the proper libs.

How can I fix this?

Virtually,
Michael D. Morris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clangtest.c
Type: text/x-csrc
Size: 2578 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110307/d11d0dd4/attachment.c>


More information about the cfe-dev mailing list