简体   繁体   中英

LINK : fatal error LNK1561: entry point must be defined in empty project

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?

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

在此处输入图片说明

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

在此处输入图片说明

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM