错误LNK1561:入口点必须被定义 [英] Error LNK1561: entry point must be defined

查看:851
本文介绍了错误LNK1561:入口点必须被定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与Visual Studio 2012年的工作。

I am working with Visual Studio 2012.

我的解决方案有3个项目

My Solution has 3 projects

了projectA

projectA

项目B

projectB

项目C

projectC

和层次是像

项目C 取决于项目B 这又依赖于了projectA 。有一个主要功能在项目C和项目B和了projectA无主。
那我得到的错误是:

projectC depends on projectB which in turn depend on projectA. There is a main function in projectC and no main in projectB and projectA. The errors that i am getting are:

error LNK1561: entry point must be defined      projectA
error LNK1561: entry point must be defined      projectB

我试图在不断变化
配置属性 - >链接器 - >系统 - >子系统控制台(/子系统:CONSOLE),但问题仍然存在。

I have tried changing in the Configuration Properties -> Linker -> System -> SubSystem to Console (/SUBSYSTEM:CONSOLE) But the problem still persists

帮我出这一点。

推荐答案

看来,你误解的术语模块。有一个在Visual Studio中没有这样的C ++项目; C ++项目可分为三类:

It seems, that you misunderstand the term "module". There is no such C++ project in Visual Studio; C++ projects may be divided into three categories:


  • 程序 - 编译生成一个 exe文件文件,它可以执行;

  • 静态库 - 编译生成一个 LIB 文件,该文件可以包含在另一个项目和编译期间链接;

  • 动态库 - 编译生成一个 DLL 文件,该文件可能会在运行时连接到你的程序,并提供额外的功能

  • Programs - compilation produces an exe file, which may be executed;
  • Static libraries - compilation produces a lib file, which may be included in another project and are linked during the compilation;
  • Dynamic libraries - compilation produces a dll file, which may be attached to your program at run-time and provide additional functionality.

从你的描述,你想要的项目B和项目C是一个静态库,而是你创造了他们的可执行文件。再次运行新的项目向导,然后选择静态库而不是Windows应用程序。

From your description, you want the projectB and projectC to be a static libraries, but instead you created them as executable files. Run the new project wizard again and choose "static library" instead of "Windows application".

您可以在 MSDN库

如果静态库过于重量级您的应用程序,你可以简单地包括在您的项目项目B和项目C文件(可选照顾命名空间不要混淆类的名称)。这一切都取决于你打算多少功能在这些模块来实现。

If static libraries are too heavyweight for your application, you may simply include projectB and projectC files in your project (optionally take care of namespaces not to confuse the names of classes). It all depends on how much functionality you plan to implement in these "modules".

这篇关于错误LNK1561:入口点必须被定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆