LINK : fatal error LNK1561: entry point must be de

2019-07-22 01:21发布

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 : 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.

What do I have to put there?

Is there another better option to create a C++ library?

2条回答
等我变得足够好
2楼-- · 2019-07-22 01:40

To create a static library in VS 2017 version 15.3.4, first select the "Windows Desktop Wizard" template,

enter image description here

In the wizard dialog that pops up, change the application type to static library:

enter image description here

You might also want to turn off precompiled headers, since with Visual C++ that gives a non-standard preprocessor behavior.

查看更多
小情绪 Triste *
3楼-- · 2019-07-22 01:57

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)".

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

查看更多
登录 后发表回答