链接:致命错误 LNK1561:必须在空项目中定义入口点 [英] LINK : fatal error LNK1561: entry point must be defined in empty project
问题描述
我使用 Visual Studio 2017 15.3.4 社区版创建了一个 Visual C++ 空项目,选择 Visual C++ -> 常规 -> 来自向导的空项目.我想创建一个 C++ 库(静态或动态).
I have created a Visual C++ empty project with Visual Studio 2017 15.3.4 Community edition selecting Visual C++ -> General -> Empty project from wizard. I wanted to create a C++ library (static or dynamic).
但是当我编译它时,我收到此消息:
But when I compile it I get this message:
LINK:致命错误 LNK1561:必须定义入口点
LINK : fatal error LNK1561: entry point must be defined
我已右键单击项目",选择属性"、链接器"和高级",入口点"选项为空.
I have right clicked on Project, select Properties, Linker and advanced and Entry Point option is empty.
我必须在那里放什么?
还有其他更好的选择来创建 C++ 库吗?
Is there another better option to create a C++ library?
推荐答案
库没有入口点,因此您可以判断项目配置不正确.您忘记更改的特定设置是项目 > 属性 > 常规 > 配置类型.选择静态库(.lib)".
A library does not have an entrypoint, so you can tell that the project is not configured correctly. The specific setting you forgot to change is Project > Properties > General > Configuration Type. Select "Static library (.lib)".
这是错误的,因为您从头开始,必须正确设置数十项从来都不是问题.对于 VS2017 RTM,您会喜欢从 Win32 > Win32 Project > Next > "Static library" 单选按钮开始.也许这改变了,我没有更新它,因为我看到了太多关于 15.3.x 的讨厌的错误报告
This went wrong because you started from scratch, having to get dozens of settings right is never not a problem. For VS2017 RTM you'll favor starting from Win32 > Win32 Project > Next > "Static library" radio button. Maybe that changed, I haven't kept it updated because I've seen too many nasty bug reports for 15.3.x
这篇关于链接:致命错误 LNK1561:必须在空项目中定义入口点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!