Msvcrtd.lib(exe_main.obj):错误LNK2019:函数中引用的未解析的外部符号_main“int __cdecl invoke_main(void)" [英] Msvcrtd.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)"
本文介绍了Msvcrtd.lib(exe_main.obj):错误LNK2019:函数中引用的未解析的外部符号_main“int __cdecl invoke_main(void)"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个主程序开头:
I've got a main program starting with:
int main(int argc, char**argv)
{
.....
}
编译成功,但是当我构建它时,我得到的消息如下。这意味着我的主程序是exe_main()对象引用的未解析符号。我很困惑。
It is compiled successfully, but when I built it, I got message as below. It means that my main program is an unresolved symbol to be referenced by exe_main() object. I got confused.
1>------ Rebuild All started: Project: dsim, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(368,5): warning MSB8004: Output Directory does not end with a trailing slash. This build instance will add the slash as it is required to allow proper evaluation of the Output Directory.
1> dsim.cpp
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)
1>.\Debug\dsim.exe : fatal error LNK1120: 1 unresolved externals
我尝试过:
我用
What I have tried:
I googled it by "
LNK2019
来搜索它,但所有情况都与我的不同。
" but all cases are different from mine.
推荐答案
可能有很多原因可能隐藏在项目设置中的某个地方。但找到错误的设置是一项任务,只能由你完成。
最简单的解决方案是创建一个新项目,选择合适的应用程序类型(我想它是一个非Unicode控制台应用程序)并使用创建的文件模板,其中包含主
函数。然后将现有代码复制并粘贴到创建的文件中,并根据需要添加其他现有的源文件和头文件。
There may be many reasons probably buried somewhere in your project settings. But finding the wrong setting is a task that can be only done by you.
The simplest solution would be creating a new project choosing the appropriate application type (I guess it is a non Unicode console application) and using the created file templates which contain amain
function. Then copy and paste the existing code into the created files and add other existing source and header files as necessary.
这篇关于Msvcrtd.lib(exe_main.obj):错误LNK2019:函数中引用的未解析的外部符号_main“int __cdecl invoke_main(void)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文