Is an IDE Necessary for Debugging Fortran Code?

In summary, I am having trouble building a FORTRAN project. I have tried different options but am not sure what they mean. I think I should look into getting a different project type to work.
  • #36
Perhaps you could select HelloWorld2 Debug in the project explorer in the left window?

And then perhaps click the button Run?
 
Technology news on Phys.org
  • #37
I like Serena said:
Perhaps you could select HelloWorld2 Debug in the project explorer in the left window?

And then perhaps click the button Run?

I erased the C++ project so Eclipse doesn't get confused. I highlighted the debug folder and this is what I get when I click run. Notice the rather empty build message in the console again. This is pretty awful. If Eclipse is this difficult to get Hello World running, I cannot imagine getting any real work done on it. Thanks again for all your help. Feel free to call it a day whenever you need to. Getting Fortran to run on a Mac is the stuff of legend and I am now seeing why.

Screenshot2011-12-29at61459PM.png
 
  • #38
Perhaps you can show the Run Configurations screen that you used?

It appears that the first edit field (where you had C/C++ Application before) was not filled properly...
 
  • #39
I like Serena said:
Perhaps you can show the Run Configurations screen that you used?

It appears that the first edit field (where you had C/C++ Application before) was not filled properly...

I did not set up a run config this time. I just clicked the 'play' button.
 
  • #40
Ah, I'm afraid the Play button only works after the first time that you've succesfully run the application.
It's a sort of most-recently-run menu option.

The first time round it won't do anything useful.
 
  • #41
I like Serena said:
Ah, I'm afraid the Play button only works after the first time that you've succesfully run the application.
It's a sort of most-recently-run menu option.

The first time round it won't do anything useful.

Hmmm. Ok. Now that I have removed the C++ project, the context sensitive options I am given are a little different. There is a Rin Config option now. I am going to delete the workspace folder and the current projects and start fresh. I will post exact step-by-step screenshots of what I do.

Thanks again boss!
 
  • #42
If it's not too late already, try to avoid directories with spaces in them!
Command line tools (such as used in Eclipse) are notoriously bad with those and can respond unpredictably.
 
  • #43
This is what I have done:
.
.
.
1) Launch Eclipse and Open a 'Fortran Perspective'

Screenshot2011-12-29at73441PM-1.png

.
.
.
2) Create New Fortran Project:

Screenshot2011-12-29at73531PM.png

.
.
.
3) Add Source Folder and File

Screenshot2011-12-29at73726PM.png

.
.
.
4)Write Source Code and Build Project...

Screenshot2011-12-29at73926PM.png


...Resulting in Following Console output:

Code:
**** Build of configuration Debug for project HelloWorldProject ****

make all 
Building file: ../HelloWorldSource/HelloWorld.for
Invoking: GNU Fortran Compiler
gfortran -funderscoring -O0 -g -Wall -c -fmessage-length=0 -o "HelloWorldSource/HelloWorld.o" "../HelloWorldSource/HelloWorld.for"
Finished building: ../HelloWorldSource/HelloWorld.for
 
Building target: HelloWorldProject
Invoking: MacOS X Fortran Linker
gfortran  -o "HelloWorldProject"  ./HelloWorldSource/HelloWorld.o   
Finished building target: HelloWorldProject
 

**** Build Finished ****
.
.
.
5) On Toolbar go to: 'Run' and I am presented with the following options:

Screenshot2011-12-29at75301PM.png


.
.
.
.
.
I am tempted to say that I should just be able to go to 'Local Fortran Application' and run it. Do I need to actually go into the 'Run Configurations...' menu ?
 
  • #44
"Run As / Local Fortran Application" should be fine.
 
  • #45
I like Serena said:
"Run As / Local Fortran Application" should be fine.

Should be but is not. I get the Launch Failed: Binary Not Found error again:
.
.
.

6)

Screenshot2011-12-29at80309PM.png
 
  • #46
Can you right-click the binary HelloWorldProject and select Run configurations?
 
  • #47
I like Serena said:
Can you right-click the binary HelloWorldProject and select Run configurations?

When I Right-Click the Binary and select Run As -> Run Configurations I am presented with the following screen:

Screenshot2011-12-29at81206PM.png


I am not sure what to do next? I am thinking click on 'Fortran Local Application' and then click the 'New' button. What do you think?
 
  • #48
Yep. That's it.
 
  • #49
Ok :smile: When I click on 'Fortran Local Application' and then click the 'New' button I am presented with the following screen:

Screenshot2011-12-29at81725PM.png


It looks like Eclipse wants me to specify the Binary? If I click: 'Search Project...' I am presented with:

Screenshot2011-12-29at81931PM.png


Does this mean Eclipse is not 'seeing' the binary (maybe this explains error message)?

Maybe I should try to 'Browse' all the way to the Binary?
 
  • #50
Yep. Try Browse all the way to the binary.

Btw, Search project should work, but we'll see... just keep an eye out for weird stuff.
 
  • #51
I like Serena said:
Yep. Try Browse all the way to the binary.
Ok. Should I 'Apply' or 'Run' ? I am thinking Apply, then Run if necessary.

Btw, Search project should work, but we'll see... just keep an eye out for weird stuff.

Yeah. Search Project definitely not working. You can see that the window it gave me is empty.
 
  • #52
Yeah, do Apply first and then Run.

What is the path to your binary?
Does it contain a space?
 
  • #53
I like Serena said:
Yeah, do Apply first and then Run.

I can't believe that this worked! All that work for a simple Hello World.

What is the path to your binary?
Does it contain a space?

Code:
/Users/saladsamurai/Documents/workspace_PTP/HelloWorldProject/Debug/HelloWorldProject

No spaces.

Now I am wondering what I will need to do every time I create a new project. I will create a HelloWorld2 project to see what Eclipse "remembers" and what it forgets.

Thanks SO MUCH for all of your effort ILS! Next time you're in the US I'll buy you a coffee :smile:
 
  • #54
Cheers! :smile:
 
  • #55
I like Serena said:
Cheers! :smile:

Now for the hard part: Getting C++ and Java to work in the same IDE! I am pretty sure C++ is ready to go. But I had some trouble with Java... I'll mess around a bunch and post back with my findings!
 
  • #56
Or, you could save yourself a lot of grief by

1. Learn how to use "make"
2. Learn how to configure your favorite text editor to run "make" with a single keystroke
3. Never use an IDE again ...

Everybody who writes an IDE seems to have their own ideas about what is "easy and intuitive". And none of them ever match MY ideas about what is easy and intuitive!
 
  • #57
AlephZero said:
Or, you could save yourself a lot of grief by

1. Learn how to use "make"
2. Learn how to configure your favorite text editor to run "make" with a single keystroke
3. Never use an IDE again ...

Everybody who writes an IDE seems to have their own ideas about what is "easy and intuitive". And none of them ever match MY ideas about what is easy and intuitive!

Indeed! How do you debug without an IDE?
 
  • #58
It appears that I have to navigate to the path manually every time and set up run configurations. I am still convinced that when I click on 'search project' Eclipse should be 'seeing' the binary it just created, but as in Post #49 in the 2nd screenshot, it is not seeing it.

When I click 'Search Project' could it be looking on the wrong path? I am assuming that Eclipse must be looking on what is referred to as the "Build Path." There must be a way to check what it thinks the Build path is...
 
  • #59
Eclipse keeps a cache in which it remembers what it has built.

When you build an executable using the terminal window, you typically get this problem that Eclipse doesn't "see" the executable with "Search project".

The way I know to recover from that, is to let Eclipse rebuild everything (Ctrl+B).Anyhow, after the first time you adjusted the run configuration, Eclipse will remember the location of the executable.
 
  • #60
Saladsamurai said:
Indeed! How do you debug without an IDE?

An IDE doesn't debug your code for you.

You debug code by thinking. and playing with an IDE is often a distraction from that.

Of course you need a debugger to tell you the basic information like where your code crashed. But 99% of the time you can get all the information you need from a core dump and a stack trace, wthout the pretty graphics.
 
  • #61
AlephZero said:
An IDE doesn't debug your code for you.

You debug code by thinking. and playing with an IDE is often a distraction from that.

Of course you need a debugger to tell you the basic information like where your code crashed. But 99% of the time you can get all the information you need from a core dump and a stack trace, wthout the pretty graphics.

I AlphaZero! :smile: I was just messing around with XCode and I noticed the term GDB everywhere. So I looked it up. It's a debugger! So yes, I understand now that an IDE is not a debugger.

So let's say for a second that I want to get into programming without an IDE. So I would need to learn about these things that you mentioned: core dump, stack trace and probably other things as well. Are these things that are generated by the 'debugger' (e.g. GDB)?
 
  • #62
AlephZero said:
An IDE doesn't debug your code for you.

You debug code by thinking. and playing with an IDE is often a distraction from that.

Of course you need a debugger to tell you the basic information like where your code crashed. But 99% of the time you can get all the information you need from a core dump and a stack trace, wthout the pretty graphics.

I kind of like point-and-click, multiple-views and language-sensitive-keyboard-shortcuts to make it easier to find compiler errors and to debug code. :)

To find problems in mathematical formulas I agree that an IDE tends to distract.
 

Similar threads

  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
4
Views
2K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
2
Replies
59
Views
9K
  • Programming and Computer Science
Replies
8
Views
4K
  • Programming and Computer Science
Replies
29
Views
5K
  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
1
Views
3K
Back
Top