Reputation: 1421
Is this visual studio specific or all c++ projects behave this way?
Why??
Upvotes: 0
Views: 452
Reputation: 38766
Because in Visual Studio, the term "project" is defined to be the entity (a set of source files) that emits one binary build artifact (dll / exe / static lib / ...).
Note: A project actually can and does generate different binary artifacts (debug vs. release vs. configuration-xy) but normally all from the same set of source files.
If you want to create more than one executable with a varying but overlapping set of source files, then you should split your solution into multiple projects:
Upvotes: 1
Reputation: 106068
C++ generally has no concept of a solution... the Standard only defines what happens in the context of each translation unit (some of which relates to creating objects that can link properly). The most widespread project build tool used for development is probably still make
, which allows multiple targets to be defined.
Upvotes: 1
Reputation: 56083
If you want to build more than one executable, then you can have several projects defined in the same "solution" file.
Upvotes: 6
Reputation: 6768
How would you make the difference between the 2 different main of the two program ? It is quite complicated to know which source is for the programe 1 and which source is for the program 2. Thus, you need 2 different projects for 2 executable.
If you have shared source code between your two project, you can have a library (in a different project ^^).
Upvotes: 1