LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2012, 01:45 PM   #1
kiki strumm3r
LQ Newbie
 
Registered: Feb 2012
Posts: 13

Rep: Reputation: Disabled
first time linux user, need help setting up ubuntu to write code in fortran


Hello,
I am a college student taking a class that requires programming in Fortran. I decided to install Ubuntu on an old laptop as the only operating system (both to use for fortran and to check out Linux [love it]). Ubuntu is installed, working fine as far as I can tell, and is connected to the internet and updated. Also, I found the terminal and have that pinned to the launcher. I have no real prior knowledge of Linux, but have used C and MATLAB before.

I need a code editor (not even sure if that's the right term, I need something to physically write the code), a compiler, and eventually need to be able to execute my code. From Ubuntu's software center, I installed gfortran and gnuplot, which is something that I will eventually need, but need to write the code before using that. I also installed all the add-ons for both.

I looked around a little in these forums for some help and also downloaded Intel's "Fortran Composer XE for Linux", which came as a .tgz file. I couldn't find anything in Intel's suite to physically install it to my machine (there's a script file labelled install, but double clicking only opens the script, it doesn't run it).

Like I said, I am a first-time Linux user and am very frustrated at my lack of knowledge on the subject. If someone could help me I would be very thankful.

P.S. can anyone recommend a good book on programming in fortran? Found some websites (and obv here), but I kind of want to have a book as a reference
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-07-2012, 02:03 PM   #2
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
I looked around a little in these forums for some help and also downloaded Intel's "Fortran Composer XE for Linux", which came as a .tgz file. I couldn't find anything in Intel's suite to physically install it to my machine (there's a script file labelled install, but double clicking only opens the script, it doesn't run it).
If it has an installer file, you have to make executeable.
Right-click on the downloaded file select Properties>>Permissions & check the box that says "allow to execute file as a program". If the file doesn't execute you have to untar manually.

Last edited by EDDY1; 02-07-2012 at 02:37 PM.
 
Old 02-07-2012, 02:07 PM   #3
kiki strumm3r
LQ Newbie
 
Registered: Feb 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
thanks. i untarred it and am installing it now
 
Old 02-07-2012, 02:20 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,552

Rep: Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112
No need, you're making this too complicated

Composer - any text editor, take your pick. Ubuntu already has many installed, and you can install many more. Emacs, Pico, Nano, Vim, the list goes on and on...most have syntax highlighting built in for the big languages (C, C++, Fortran, etc)
Compiler - you already downloaded gfortran, that's all you need
Running - you already found the terminal, that's how you run it

You already have everything you need.

Open a terminal, create and cd into a working directory
Code:
mkdir ~/programming
cd ~/programming
Open a new file with the text editor of your choice
Code:
emacs test.f90
Enter the following code:
Code:
double precision :: pi
pi = atan(1d0)*4d0
print *,pi
end
Save and quit out of your text editor, then back in the terminal compile your code
Code:
gfortran -o test test.f90
Then run it
Code:
./test
 
2 members found this post helpful.
Old 02-07-2012, 04:34 PM   #5
clocker
Member
 
Registered: Sep 2011
Distribution: fedora, redhat, mint
Posts: 87

Rep: Reputation: Disabled
Every linux distribution comes with good vi (visual editor). So you already have a text editor.

For the compiler you noted that you have downloaded.

Quote:
I looked around a little in these forums for some help and also downloaded Intel's "Fortran Composer XE for Linux", which came as a .tgz file. I couldn't find anything in Intel's suite to physically install it to my machine (there's a script file labelled install, but double clicking only opens the script, it doesn't run it).
So you need to unpack, recompile the zipped file like this;

Quote:

to unzip
#gzip -d application_name.tar.gz

to extract
#tar -xvf application_name.tar

cd into the directory with the application an run the /.INSTALL
or
/.configure
make
make install
 
Old 02-07-2012, 04:41 PM   #6
clocker
Member
 
Registered: Sep 2011
Distribution: fedora, redhat, mint
Posts: 87

Rep: Reputation: Disabled
In c and c++, we use gcc and g++ respectively at the terminal to check if the compiler is installed. Try to run a command for Fortran to check if it has been installed. For your next installation try to Install a work station, software development box and in customizing your box load it with lots of development tools including Fortran.That works for Fedora.
 
Old 02-07-2012, 05:20 PM   #7
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,552

Rep: Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112
Quote:
Originally Posted by clocker View Post
So you need to unpack, recompile the zipped file like this;
He doesn't need to do any of that unless he actually wants Fortran Composer XE. Since he just found it through Googling, I highly doubt he actually knows whether or not he wants that application, there's no need for it. He already has everything he needs to write, compile, and run Fortran code. Installing a big IDE will just overcomplicate and confuse things at this point in his education in my opinion.


Quote:
Originally Posted by clocker View Post
In c and c++, we use gcc and g++ respectively at the terminal to check if the compiler is installed. Try to run a command for Fortran to check if it has been installed.
The GNU fortran compiler is gfortran, according to the OP he already installed it.
 
2 members found this post helpful.
Old 02-08-2012, 08:14 AM   #8
salasi
Senior Member
 
Registered: Jul 2007
Location: Directly above centre of the earth, UK
Distribution: SuSE, plus some hopping
Posts: 4,064

Rep: Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894Reputation: 894
Quote:
Originally Posted by kiki strumm3r View Post
I need a code editor (not even sure if that's the right term, I need something to physically write the code)...
Code editors/programmer's editors come in a number of flavours, and it will probably be a while before you finally settle on something that you are likely to stick with.

IDEs are probably something that you will hear mentioned, but now is almost certainly not the right time, unless your course is explicitly IDE-based. Something like Eclipse (...or a derivative...) has lots of facilities, but it will just confuse the issue at a time when you are probably struggling with a lot of other new stuff. It may not even be what you want to adopt, once you have stopped struggling with the compiler, the language syntax, the environment.

For 'simpler' text editors, the traditional debate (or 'flame war') has been between vi (and derivatives, such as vim, which are 'almost the same thing' from a learning point of view) and emacs. vi is probably easier to get started with and emacs offers more clever stuff once you have learnt it, but that's a very broad brush distinction. I think you'd have to say that, at this point, trying vi is a good thing, but you won't know whether you like it until you have tried something else as well.

Personally, I don't use either out of preference; when there is a GUI available, I use Kate. This is a Kde program, but does run under other GUIs (eg, Gnome), but running it under another GUI does pull in a lot of kde libraries, so might not be the best choice if the PC has limited memory. When a GUI is a bad idea, or when it won't start, etc, I use Joe (Joe's Own Editor), but that's because I got used to Wordstar many years ago, and Joe is a Wordstar-alike...and the key mappings are quite nice, but I'm not sure if any of that is a sufficient argument for anyone who hasn't used Wordstar before.
 
1 members found this post helpful.
Old 02-09-2012, 02:30 AM   #9
kiki strumm3r
LQ Newbie
 
Registered: Feb 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
First: Thank you so much. You've helped me a hell of a lot more than my professor has.

Now I have a couple more questions if you would be so kind: I decided to say screw it and install Linux onto my newer laptop alongside Windows and I'm trying to figure out exactly which version to install. I'm going to use Fedora, mostly because everyone I know who has used Linux uses Fedora. I looked at a couple different spins, and I want to combine a couple of them together and I'm trying to figure out the easiest way how to do that. The two spins I think I want are the Scientific and Electronic-Lab spins. I downloaded both .iso's and also the non-Live Media .iso and am wondering if the non-Live Media DVD contains both spins. I know I need the Scientific so if anything I was thinking install the Scientific and then see if there's a way to download/install the second spin.

Also, can anyone suggest software that will allow me to use the blu-ray drive I have (if I decide to ditch Windows I still want to be able to watch movies). I know everything in Linux is supposed to be free, but I know there are also exceptions to every rule so if it costs money, as long as it works I'm OK with that.

And finally a question on the media I have on Windows. If I decide to completely get rid of Windows (I'm thinking probably in a year if I'm comfortable enough with it), is there a way to import files from the Windows partition of my hard drive (and vice-versa)?
 
Old 02-09-2012, 02:40 AM   #10
kiki strumm3r
LQ Newbie
 
Registered: Feb 2012
Posts: 13

Original Poster
Rep: Reputation: Disabled
ok, so now I just looked at it a little bit more and saw I can install it using yum, which I'm assuming is software I can download. So it says I can install it using the following:

# yum groupinstall 'Electronic Lab'

I just enter that in the terminal right? (Once I have yum installed, which I'm sure is easy).

Oh and another question, other than "Linux for Dummies" (which I'm sure is helpful and I'm considering buying it), is there a book that any of you would recommend as a reference for Linux and/or Fortran?
 
Old 02-09-2012, 11:13 AM   #11
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,552

Rep: Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112Reputation: 2112
You are correct, the software included in all of those different "spins" can simply be installed using yum. Yum is already pre-installed in Fedora, it's the primary package management system. Nearly all of your software installation and updating will be done via yum.

Same goes for the packages you select during installation. If you miss any, you can just install them later on using yum.
 
Old 02-09-2012, 01:54 PM   #12
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Oh and another question, other than "Linux for Dummies" (which I'm sure is helpful and I'm considering buying it), is there a book that any of you would recommend as a reference for Linux and/or Fortran?
http://linuxcommand.org/
http://rute.2038bug.com/index.html.gz
 
Old 02-09-2012, 08:50 PM   #13
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
In addition to the above, www.linuxtopia.org has more books/manuals than you'll ever need
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Long time Windows and multi-systems user, but new to Linux/Ubuntu -- Hello docklc LinuxQuestions.org Member Intro 2 08-01-2011 11:58 AM
First time Linux user - Ubuntu 9.04 - can't connect to the internet Neo Jettero Linux - Networking 3 10-11-2009 04:08 AM
Real time and user-space code raedbenz Linux - Embedded & Single-board computer 0 07-15-2008 04:38 AM
compile old fortran code in linux v2010 Linux - Software 2 12-13-2005 05:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration