- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
I always used fortran but now I have to mix two languages(FORTRAN,C). I followed these steps:
- I made the 'c' code;
-I used the 'c' compiler to create the object file(.obj);
- I created a new fortran project;
My doubt is only this one: how can I say to the compiler inside the IDE, and not in command prompt, to compile with the c object file? Where is that option?
thanks in advance
Peter
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will need to create a separate project in your solution for your C code. If you have Fortran main program, you can add a C static library project in your solution, include your C code in that project, and link your Fortran against the lib file generated in the C project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Also, take a look at the Intel Fortran samples for mixed-language programming:
User and Reference Guide for the Intel® Fortran Compiler 14.0
Using the Intel® Fortran Samples
The following applies to Fortran for Microsoft Visual Studio* 2010 and 2008.
The Intel® Fortran Compiler installs a number of sample programs. These programming samples illustrate a variety of concepts such as:
Creating console applications
Creating QuickWin applications
Creating Win32 applications
Using mixed-language support
Using OpenGL* in Fortran applications
The programming samples are located in the<install-dir>\Samples\ directory. These samples have associated build files that use the Intel® Fortran Compiler, in command-line mode, to compile and build the Fortran sources.
For further information on the samples and how to use them, use a web browser to open and read the samples.htm document in the \Samples\ folder.
Parent topic: Using Microsoft* Visual Studio* (Windows* OS)
Alos, look at the documentation in "User and Reference Guide for the Intel Fortran Compiler" under Compiler Reference, Mixed Language Programming.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the answer
But now I have a new doubt. How can I creat a 'C' static library inside IDE?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
P R. wrote:
...
But now I have a new doubt. How can I creat a 'C' static library inside IDE?
There is an infinite amount of information available online on how to use Visual Studio for various C/C++ projects. Go through Visual Studio help, consult MSDN (Microsoft site), StackOverflow, CodeProject, etc. and you will find lots of useful links like this one: http://msdn.microsoft.com/en-us/library/vstudio/ms235627(v=vs.110).aspx. Note on this link the section on "Creating a console app that references the static library" - this can readily apply to your scenario if you have a main project that is written in Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, P R, you can find some informations over here (http://msdn.microsoft.com/en-us/library/ms235627.aspx), I think that it could be useful for you! It is not difficult to do this...

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