13

I am working with Visual Studio 2012.

My Solution has 3 projects

projectA

projectB

projectC

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.

Euler
  • 652
  • 3
  • 11
  • 24
  • From the sound of things, you only want one project, which should include all three classes (or whatever exactly they are). – Jerry Coffin Jun 21 '13 at 05:38
  • What *are* rtpDecoder and rtpDsTestsuite? Are they also programs or static/dynamic libraries? – Spook Jun 21 '13 at 05:38
  • Add your program in the question body. – Jayram Jun 21 '13 at 06:02
  • The original names of projects are in question's and answer's history anyway, so changing them does not change much if one wants to see them... – Spook Jul 18 '13 at 06:40

4 Answers4

21

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

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254
Spook
  • 25,318
  • 18
  • 90
  • 167
  • 2
    Rather than using the wizard to create a new library, you can also change this setting for an existing project via `Configuratin Properties > General > Configuration Type`. If you change that field, you'll probably also want to change `Configuration Properties > General > Target Extension` too. – MatrixManAtYrService Nov 12 '16 at 20:27
11

set Properties -> Linker -> System -> SubSystem to "Windows (/SUBSYSTEM:WINDOWS)"

user2852297
  • 109
  • 1
  • 3
4

What's happening possibly, what was happening with me, is that when you switch your properties of your project to .dll from .exe, if you switch from debug to release or from x86 to x64, each time you do that it's switching you back to .exe. Each configuration has it's own properties.

So, go to Properties > Configuration Type > .dll

If indeed you want to make a .dll.

Mark Aven
  • 325
  • 3
  • 8
  • My problem was that my configurations were defined for x64 but accidentally had x86 selected when building – iedoc Nov 23 '19 at 16:26
-1

I'm going to guess you're using Windows for creating this project, for me, if I usually use SDL I get this error, all you have to do is type in this #include <Windows.h> that should fix it, if not then I'm not to sure how to fix that.

One Ace
  • 31
  • 5