CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

gfortran compilation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2011, 18:06
Default gfortran compilation
  #1
Senior Member
 
Hassan
Join Date: Apr 2009
Posts: 106
Rep Power: 17
HaKu is on a distinguished road
i have a code in gfortran...

i need to change the code so obviously i need to see that whether changes r fine or r there any errors..

so how can i compile the code for errors?? and then how to Run it...

regards
HaKu is offline   Reply With Quote

Old   May 3, 2011, 23:41
Default
  #2
Senior Member
 
Join Date: Nov 2009
Posts: 411
Rep Power: 19
DoHander is on a distinguished road
Suppose your program is named test.f90, open a Command Prompt in the folder where your Fortran code is placed and write:

gfortran test.f90 -o test.exe

If you will see no error messages and you will obtain a new file test.exe then your original program was free of syntax errors. If you want to run the new program just write in the same Command Prompt window:

test.exe

Do
DoHander is offline   Reply With Quote

Old   May 4, 2011, 18:16
Default
  #3
New Member
 
Eezyville's Avatar
 
Chris
Join Date: Oct 2010
Location: Toledo, OH
Posts: 24
Rep Power: 15
Eezyville is on a distinguished road
Send a message via Skype™ to Eezyville
Try this:

gfortran -g -o Output Program.f90

Output being the executable. The option -g allows the compiler to generate debug symbols for debugging. The compiler should catch syntax errors automatically. if you are on linux you can use the gnu debugger to debug the code. I don't know what to use on windows.
Eezyville is offline   Reply With Quote

Old   May 4, 2011, 20:08
Default
  #4
Member
 
Join Date: Mar 2009
Posts: 62
Rep Power: 17
RenardP is on a distinguished road
@Eezyville

"I don't know what to use on windows."

On Windows you will use the same gdb debugger ...
RenardP is offline   Reply With Quote

Old   May 4, 2011, 22:58
Default
  #5
Senior Member
 
Hassan
Join Date: Apr 2009
Posts: 106
Rep Power: 17
HaKu is on a distinguished road
thanks to all. ill check this gnu debugger....
HaKu is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
errors during compilation and installation of OpenFOAM-1.7.x on Ubuntu 10.04 ftec OpenFOAM Installation 7 February 23, 2011 06:07
Compilation Order and Single Precision Issues gocarts OpenFOAM Bugs 1 October 14, 2009 17:19
Compilation Error when running Tutorial 2.4 zhihuali Siemens 7 April 1, 2008 07:34
Compilation error with uparm.f Raghu Siemens 2 May 30, 2007 02:09
Compilation Error.... Arnab Siemens 4 September 12, 2004 15:54


All times are GMT -4. The time now is 17:08.