Euler Euler - 1 year ago 107
C Question

Error LNK1561: entry point must be defined

I am working with Visual Studio 2012.

My Solution has 3 projects




and the Hierarchy is like

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

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

Help me out of this.

Answer Source

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:

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

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

You can read more about static libraries in the MSDN library.

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