- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I can not tolerate this any more. Is it possible to put more than one f90 files in one project? What I expect is that I put more than one f90 files in one project. I open only one f90 file at one time. When I press F5, the opened file is compiled and run and give me the result.
I don't care how the f90 file starts, program, module, interface, subroutine, etc.
My question arises because I usually work on a set of machine learning algorithms. When I use matlab, I open most of them, and only the file I work on will be run when pressing F5. Could I have the similar way to work by IVF & VS?????? Otherwise, now, I add one existing f90 file to the project and then when I want to run another existing f90 file, I have to remove the current one from the project so that another one can be added and run.
I don't want to create more than one project and one project has only one f90 file, because the size of the project becomes so larger from the first time the project is compiled. I have to keep deleting the debug folder or release folder manully. If I have 100 projects, the size of the solution will be too too huge. It is nightmare for me.
Could anyone give some suggestion? Thanks.
I can not tolerate this any more. Is it possible to put more than one f90 files in one project? What I expect is that I put more than one f90 files in one project. I open only one f90 file at one time. When I press F5, the opened file is compiled and run and give me the result.
I don't care how the f90 file starts, program, module, interface, subroutine, etc.
My question arises because I usually work on a set of machine learning algorithms. When I use matlab, I open most of them, and only the file I work on will be run when pressing F5. Could I have the similar way to work by IVF & VS?????? Otherwise, now, I add one existing f90 file to the project and then when I want to run another existing f90 file, I have to remove the current one from the project so that another one can be added and run.
I don't want to create more than one project and one project has only one f90 file, because the size of the project becomes so larger from the first time the project is compiled. I have to keep deleting the debug folder or release folder manully. If I have 100 projects, the size of the solution will be too too huge. It is nightmare for me.
Could anyone give some suggestion? Thanks.
Link Copied
6 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not entirely sure what you are seeing. You can have many, many .f90 files in a project. Hundreds, at least. This assumes that all these files are to be compiled together to form a single application. You would typically build the project by right clicking on the solution and selecting Build Solution, but pressing F5 to begin debugging should compile all uncompiled sources, link and then start debugging. (However, if you have not set a breakpoint, the program will run to completion and then exit.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - yingwu
Hi,
I can not tolerate this any more. Is it possible to put more than one f90 files in one project? What I expect is that I put more than one f90 files in one project. I open only one f90 file at one time. When I press F5, the opened file is compiled and run and give me the result.
I don't care how the f90 file starts, program, module, interface, subroutine, etc.
I can not tolerate this any more. Is it possible to put more than one f90 files in one project? What I expect is that I put more than one f90 files in one project. I open only one f90 file at one time. When I press F5, the opened file is compiled and run and give me the result.
I don't care how the f90 file starts, program, module, interface, subroutine, etc.
(1) Yes you can have many files is a project. In Visual Studio you can have lots of files opened either tabbed view or multiple windows for editing.
(2) "I don't care how the f90 file starts, program, module, interface, subroutine, etc."
But - Every "Program" needs to be in a seperate project,
multiple projects can be specified under one solution
and multiple files can be added to a project.
For each project you determine the kind of output (exe, library, dll etc)
You can then specify the build order so that the libs/dlls are built before the exes thatuse them.
Why are you averse to having more than one project ?
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much for the replys.
Hi, Steve. Sorry for my english not descibing my question clearly. I attach a picture to make it more clear. I have more than one F90 file and all of them start by 'program' as shown. Could I keep them in one project? I don't think I can, because I know there can be one and only one program in a project, as the main entry.
Les, your idea is possible, but it is very boring to do this. For example, the size of 'fortranTest2.F90' file is 1kb. However, after the project is compiled, the size of the project is increased to 6MB. Assuming I have 100 projects, the size of solution will be 600MB. The point is I need to keep backuping the solution, so if I do backup for 10 times, the size will be 6GB. So the only way I do is to delete the 'debug' folder. But 100 projects means 100 folders. It is so boring.
I am not developing an application. So there is no relationship among the projects, or even among the F90 files in one project.

Hi, Steve. Sorry for my english not descibing my question clearly. I attach a picture to make it more clear. I have more than one F90 file and all of them start by 'program' as shown. Could I keep them in one project? I don't think I can, because I know there can be one and only one program in a project, as the main entry.
Les, your idea is possible, but it is very boring to do this. For example, the size of 'fortranTest2.F90' file is 1kb. However, after the project is compiled, the size of the project is increased to 6MB. Assuming I have 100 projects, the size of solution will be 600MB. The point is I need to keep backuping the solution, so if I do backup for 10 times, the size will be 6GB. So the only way I do is to delete the 'debug' folder. But 100 projects means 100 folders. It is so boring.
I am not developing an application. So there is no relationship among the projects, or even among the F90 files in one project.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry but that is the way Visual Studio works :-(
One "program" per project.
The size of the project will be due to the compiled output (obj) files, the build log file, the pdb file, any map file (if selected), and of course the exe file itself (plus any input/output data files if you have run the program).
Also Debug files by their very nature are bigger than Release files.
You could always do a "build/select all/clean" before the backup (assuming you only need to backup the source code).
OR
You could have a project containing one file x.f90
which would consist of one line
include mainprogram.f90
You would have two files open in VS x.f90 and the program you are working on.
modify the include statement in x.f90to be the name of the file you actually wish to run
compile, build and run x.exe
repeat as necessary
Les
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could use conditional compilation
!DEC$ IF DEFINED (_AS_SUBROUTINE)
subroutine testMatfor
!DEC$ ELSE
program testMatfor
!DEC$ ENDIF
...
!DEC$ IF DEFINED (_AS_SUBROUTINE)
end subroutine testMatfor
!DEC$ ELSE
end program testMatfor
!DEC$ ENDIF
Then create one additional source file
!DEC$ IF DEFINED (_AS_SUBROUTINE)
program mainStub
call testMatFor
end program mainStub
!DEC$ ELSE
subroutine mainStub
! nothing
end subroutine mainStub
!DEC$ ENDIF
Then in the IDE define _AS_SUBROUTINE when compiling for testing.
Edit mainStub to change which "program" you want to call
And/or call several such "programs"
The other route you can do is use FPP (Fortran Preprocessor)
Change
program testMatfor
to
Program testMatfor (upcase the p)
then either define or not define a macro named "Program" to contain the value "subroutine"
/DProgram=subroutine (add as command line argument)
FPP macros are case sensitive
When you omit "/DProgram=subroutine" from the command line arguments then Program passes to the compiler unchanged i.e. equivilent to program or PROGRAM (or PrOgRaM, etc...). However when you include "/DProgram=subroutine" in the command line arguments then
Program is replaced with subroutine
program is not replaced
PROGRAM is not replaced
etc...
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks everybody. Finally, I take the les's suggestion by cleaning the project. That is what I want!!!!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page