zoukankan      html  css  js  c++  java
  • 无法解析的外部符号 _WinMain@16 fatal error LNK1120: 1 个无法解析的外部命令

    一,问题描述
    MSVCRTD.lib(crtexew.obj) : error LNK2019: 无法解析的外部符号 _WinMain@16,该符号在函数 ___tmainCRTStartup 中被引用
    Debugjk.exe : fatal error LNK1120: 1 个无法解析的外部命令

    error LNK2001: unresolved external symbol _WinMain@16
    debug/main.exe:fatal error LNK 1120:1 unresolved externals
    error executing link.exe;

    二,原因及解决办法
    产生这个问题的真正原因是c语言运行时找不到适当的程序入口函数,

    一般情况下,如果是windows程序,那么WinMain是入口函数,在VS2008中新建项目为“win32项目”

    如果是dos控制台程序,那么main是入口函数,在VS2008中新建项目为“win32控制台应用程序”

    而如果入口函数指定不当,很显然c语言运行时找不到配合函数,它就会报告错误。

    修改设置适应你的需求

    如果是windows程序:

    1.菜单中选择 Project->Properties, 弹出Property Pages窗口

    2.在左边栏中依次选择:Configuration Properties->C/C++->Preprocessor,然后在右边栏的Preprocessor Definitions对应的项中删除_CONSOLE, 添加_WINDOWS.

    3.在左边栏中依次选择:Configuration Properties->Linker->System,然后在右边栏的SubSystem对应的项改为Windows(/SUBSYSTEM:WINDOWS)

    如果是控制台程序:

    1.菜单中选择 Project->Properties, 弹出Property Pages窗口

    2.在左边栏中依次选择:Configuration Properties->C/C++->Preprocessor,然后在右边栏的Preprocessor Definitions对应的项中删除_WINDOWS, 添加_CONSOLE.

    3.在左边栏中依次选择:Configuration Properties->Linker->System,然后在右边栏的SubSystem对应的项改为CONSOLE(/SUBSYSTEM:CONSOLE)

  • 相关阅读:
    Codeforces467C George and Job
    Codeforces205E Little Elephant and Furik and RubikLittle Elephant and Furik and Rubik
    Codeforce205C Little Elephant and Interval
    51nod1829 函数
    51nod1574 排列转换
    nowcoder35B 小AA的数列
    Codeforce893E Counting Arrays
    gym101612 Consonant Fencity
    CodeForces559C Gerald and Giant Chess
    CodeForces456D A Lot of Games
  • 原文地址:https://www.cnblogs.com/hdk1993/p/4375948.html
Copyright © 2011-2022 走看看