Can I Compile Linux FORTRAN Code on a Windows Compiler?

In summary, the conversation discusses the portability of FORTRAN code between Linux and Windows compilers. The speaker mentions that FORTRAN is generally portable and that the main issue is with compiler specific extensions. They also mention that using the same GNU compiler on Windows should allow the code to work without any issues. The speaker also mentions the MinGW compiler, which is a GCC for Windows and allows for easy compilation of FORTRAN code on the Windows platform.
  • #1
NoobixCube
155
0
Hi,
I have a code that was written with a Linux FORTRAN compiler but is 'portable'. does this mean I am able to compile it on a windows compiler?
 
Technology news on Phys.org
  • #2
Yes, Fortran is pretty portable anyway since you don't normally do much system level stuff.
The main portability issue with Fortran is compiler specific extentions.
If you wrote it on Linux you presumably used the GNU compiler? If you use the same compiler on windows it shoudl work out of the box.
 
  • #3
I will have to look at that one. Is FORTRAN in window relatively easy to set up. I heard GCC make good compilers..?
 
  • #4
The MinGW compiler is a GCC for Windows. It has g77 and is basically like compiling FORTRAN in Linux.
 

Related to Can I Compile Linux FORTRAN Code on a Windows Compiler?

1. How can I convert my Fortran code from Linux to Windows?

The most common way to convert your Fortran code from Linux to Windows is to use a cross-platform compiler, such as GNU Fortran. This will allow you to compile your code on both Linux and Windows without having to make any major changes.

2. Are there any compatibility issues when converting from Linux to Windows?

In most cases, there should not be any major compatibility issues when converting from Linux to Windows. However, it is always a good idea to thoroughly test your code on both platforms to ensure that it runs correctly.

3. Do I need to make any changes to my code when converting to Windows?

In most cases, you should not need to make any changes to your code when converting to Windows. However, there may be some minor differences in system calls or libraries that may require slight modifications.

4. Can I use the same libraries and packages on Windows as I do on Linux?

Some libraries and packages may have different versions for Windows and Linux. It is important to check the documentation for each library to ensure compatibility. However, there are many common libraries that are cross-platform and can be used on both operating systems.

5. Is it possible to run Fortran code on Windows without a cross-platform compiler?

Yes, it is possible to run Fortran code on Windows without a cross-platform compiler by using a virtual machine or a Windows Subsystem for Linux (WSL). These options allow you to run a Linux environment on your Windows machine, allowing you to compile and run your code as if you were on a Linux system.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
1
Views
892
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
4
Views
649
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
2
Replies
62
Views
4K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
7
Views
813
  • Programming and Computer Science
Replies
0
Views
429
  • Programming and Computer Science
Replies
13
Views
2K
Back
Top