【问题标题】:Fatal error LNK1120 when compiling c project编译c项目时出现致命错误LNK1120
【发布时间】:2015-06-07 16:46:11
【问题描述】:

我尝试使用 Visual Studio 开发人员命令提示符从该项目 Emacs-FullScreen-Win32 编译 main.c,但出现以下错误:

main.c
Microsoft (R) Incremental Linker Version 11.00.60610.1

Copyright (C) Microsoft Corporation.  All rights reserved.

/out:main.exe

main.obj

main.obj : error LNK2019: unresolved external symbol __imp__ShowWindowAsync@8 re
ferenced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__SetWindowPos@28 refe
renced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__MessageBoxW@16 refer
enced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__GetWindowLongW@8 ref
erenced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongW@12 re
ferenced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__FindWindowW@8 refere
nced in function _WinMain@16

main.obj : error LNK2019: unresolved external symbol __imp__CommandLineToArgvW@8
 referenced in function _is_topmost_requested

main.exe : fatal error LNK1120: 7 unresolved externals

【问题讨论】:

  • 我将所有输出添加到问题中。
  • 您显然忽略了在链接行中包含必要的库来提取程序引用的那些导入。您至少需要User32.libShell32.lib 才能链接该图像。如果这是来自项目提供的makeautomake,您可能缺少为您的目标平台构建所需的构建开关。祝你好运。

标签: c windows visual-studio


【解决方案1】:

那些未解决的外部问题可能是由于您没有正确链接这些函数所来自的库。在您的项目设置中,转到项目属性。展开配置属性,然后展开链接器。在链接器的输入设置中,您可以在“附加依赖项”选项中指定程序所需的库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-20
    • 2017-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多