LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

前端 未结 12 2055
广开言路
广开言路 2020-12-02 18:36

I have the following error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup,

There are a lot of threads relating to this error bu

12条回答
  •  难免孤独
    2020-12-02 19:27

    I had this problem minutes ago. It went away when I added 'extern "C"' to the main() definition.

    Oddly, another simple program I wrote yesterday is almost identical, does not have the extern "C", yet compiled without this linker error.

    This makes me think the problem is some subtle setting to be found deep in some configuration dialog, and that 'extern "C"' doesn't really solve the underlying problem, but superficially makes things work.

提交回复
热议问题