- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi. I am relatively new to Fortran and visual studio, but i have some experience with other language (Java , C , C++ , perl, PHP ...). I wanted to know how to use source code from other project into my current project.
Lets say i havea project with a Module named Tool.I want to use Tool in other project without having tocopy the source file of Tool every where i want to use it.
In C , i would use something like #include "PATH to Tool "
But , i dont know how to do this in Fortran. For now i am using the USE statement. Witch gave me a check INCLUDE path error.
I have then add, in Visual Studio, the path to Tool project folderwitch content all the Tool filesin (menu : tool -> options -> intel visualfortran -> compiler)
To Executables , Librairie , Includes.
Those paths lead to all the source code .f90 (\Tool folder)and to the .mod(\Tool\Debug)
Now i can compile other program that use Tool. And can also use the Type that are defined in Tool. But i cant use anyway of the function or subroutine. I get a unresolved external symbol error.
So now i am a little lost. What does i need to do, to be able to usefunction that are in my Tool module.
I know i could maybe use a DLL, but i am in developpement stage and i dont want to have to recompile my source each time i need to change something in my Tool module
Thanks a lot for the help
P.S i dont know if i am clear enouh, if you need more details or source code let me know
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, well i am using the MODULE term in the same way as a class in Java or C++. So its one file for one class, or MODULE.
I understand that USE as the same function as #include. But since you give the name of the module (or class) and not the position of the file in the file system, i had supose that it was supose to be in the same Project.Can you use the USE statement like this :
USE "PATH to ToolTool" ???
Oo shouldi use the /Qfpp pre-processing optionand do something like this :
MODULE Work
#Include "PATH to ToolTool.f90"
USE Tool
IMPLICIT NONE
...
!Use Tool function and Subroutine
...
END MODULE Work
And thanks for the fast response!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So on a per-project basis, you would add the path to the folder containing the .mod files to the project property for "additional INCLUDE directories". You can also add it, for all projects, in Tools > Options > Intel Visual Fortran > Compilers > Include files.
I understand that this is not as simple as it should be, but modules are not simple text files that get included. Ideally, if you made one Fortran project a dependent of a second, its "output" directory would be added to the INCLUDE path of the parent - I have a feature request in for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a thought - if you don't really mean Fortran module.
If you have a fortran source file,for example
and you have a project in
then in Visual Studio Solution Explorer for your project,all you need do is
(I think you may have to click on the project"Source Files" first to highlight it)
(a) click on Project -> Add Existing Item
(b) navigate to
Then in your project code all you need do is call any subroutines/functions that are in TOOL.f90
An alternative if you have lots of files in
and the path to it would be on
Project->Properties->Linker->General->Additional Library Directories
Les

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page