Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

confusion about projects vs solutions

WSinc
New Contributor I
363 Views

My understanding about solutions is that you can have several projects within a given

solution that share common code blocks, such as subroutines, include files, etc.

You should be able to have more than one MAIN program, right ?

 

so what I have trouble with is: trying to open a NEW PROJECT, but keeping the same solution I had before.

In Visual Studio it always tries to start a NEW solution, something I obviously dont want.

 

So far I have been unable to get this to work like it's supposed to -

or perhaps I dont understand what a "solution " really is ?

Is that spelled out explicitly anywhere ?

0 Kudos
4 Replies
jimdempseyatthecove
Honored Contributor III
363 Views

>>My understanding about solutions is that you can have several projects

Yes

>>projects within a given solution that share common code blocks, such as subroutines, include files, etc

generally yes, but not necessarily. Usually a project will have a collection of subroutines/functions. e.g. a main body project, library/DLL project, general utility functions project, etc...

>>You should be able to have more than one MAIN program, right ?

While you can have multiple Fortran PROGRAM and/or C main projects within a solution, only one of these can be declared as the startup project. A library or DLL cannot be a startup project.

When starting MS VS, "New Project" creates a "New Solution" with that "New Project" contained therein.

For small applications you will have a Solution with 1 Project. As your application code grows, you may find it better to use multiple projects:

One for main/program and higher level procedures (subroutine and functions)
One for modules (think of these as C++ precompiled headers with related code)
One for static or DLL library

Jim Dempsey

 

0 Kudos
Andreas_Z_
New Contributor I
363 Views

so what I have trouble with is: trying to open a NEW PROJECT, but keeping the same solution I had before.

You can add a new project to an existing solution by doing the following:

  1. In Visual Studio's Solution Explorer, right-click on the Solution name, click Add > New Project
    [alternatively, in Visual Studio, with your target Solution open, click on File > Add > New Project]
  2. choose the type of project (e.g. Intel Visual Fortran > Console Application, or > Static Library, etc.)
  3. enter the name of the new project and click OK
  4. You will see the new project added to the Solution Explorer

Hope that helps,
Andi

0 Kudos
Steve_Lionel
Honored Contributor III
363 Views

A project builds one DLL, LIB or EXE. A solution builds an application from one or more projects. You can have only one main program in a solution.

Simple applications have a solution with one project. You would use additional projects if your application depends on a DLL or LIB, or you have partitioned your application into parts (LIBs) that get shared across several solutions.

0 Kudos
jimdempseyatthecove
Honored Contributor III
363 Views

>>You can have only one main program in a solution.

Not true. You can have only one Startup Project. This specifies the project, who's executable, is launched from Debug or Start Without Debugging. It is very common to have multiple executable for builds. Examples:

   Application + Installation program
   Application Scalar variant + Application OpenMP + Application MPI + Installation program

In the above cased, only one of which would be designated as the startup project (and all can have additional projects for static libraries, DLL libraries, test program varients, etc...)

Jim Dempsey

0 Kudos
Reply