User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » fortran compiler help Page [1]  
paerabol
All American
17118 Posts
user info
edit post

I need to write a fortran program and I'd like to get a compiler on my computer so I can fiddle with it at home. It's been 4+ years since I've done any programming and I'm having some issues with getting everything running

I downloaded g95, an open source compiler. I installed it to my c:/windows/system32/ directory, the one my console opens to by default (I know how to change this, if need be). Supposedly the command-line call to compile a program for me would be


c:/windows/system32>g95 program.ext


but it returns error "'g95' is not recognized as an internal or external command, operable program or batch file." I seem to remember I need to first type something in to initially load the compiler, but I'm not sure what this is.

Also, where does the target source file need to be located when I call it? Would "program.ext" need to be located in my system32 directory?

If someone wouldn't mind refreshing me on how this all works I'd be more than appreciative. Any specific insight into g95 would be very helpful as well

Thanks in advance

3/31/2011 10:42:15 AM

clalias
All American
1580 Posts
user info
edit post

I'd move it to a different folder then you need to add it to your path. Like

Set PATH=c:/g95/;%PATH%

-- or you can add to path this way. DO it once and you dont have to retype every time you restart
http://www.computerhope.com/issues/ch000549.htm



as for compiling:

>g95 foobar.f90 -o foobar.exe

compiles and links foobar.f90 and creates the exe named foobar.exe.

if you don't add the -o {filename} then it creates some default name

[Edited on March 31, 2011 at 10:56 AM. Reason : .]

[Edited on March 31, 2011 at 10:58 AM. Reason : .]

3/31/2011 10:54:12 AM

Novicane
All American
15416 Posts
user info
edit post

it's called FORTRAN, not fortran.

3/31/2011 11:36:03 AM

Lionheart
I'm Eggscellent
12776 Posts
user info
edit post

the problem is you're using FORTRAN

3/31/2011 3:42:20 PM

clalias
All American
1580 Posts
user info
edit post

actually, it's not typed in all caps anymore.

3/31/2011 6:42:44 PM

spöokyjon

18617 Posts
user info
edit post

If writing it in anything except Fortran is an option, I'd go for that.

3/31/2011 6:48:08 PM

clalias
All American
1580 Posts
user info
edit post

no shit. I'm sure most everyone under the age of 50 would prefer to write in something else. But there's a shit ton of legacy code + old programmers that won't accept anything but fortran modules to plug into there massively huge shit piles of common block, goto, spaghetti code.

guess you can tell what i've had to do lately


I've actually resorted to OO fortran 2003 to write modules, which has come a long way for fortran. I mean you can actually create classes and pointers now. Welcome to 1980.

3/31/2011 7:29:06 PM

paerabol
All American
17118 Posts
user info
edit post

thank you clalias...about to give it another go right now

and, for better or worse, a large portion of nuclear reactor practical coding is still done in fortran (sic)

in any case, this code needs to be

3/31/2011 7:32:24 PM

paerabol
All American
17118 Posts
user info
edit post

damn I don't even know what changing the path does and where/why i should do it

is there an idiot-proof fortran compiler out there for the clueless or at least a FORTRAN COMPILERS FOR DUMMIES guide

3/31/2011 8:14:51 PM

lewisje
All American
9196 Posts
user info
edit post

The PATH environment variable tells the operating system where to look for executables given by just a filename; first it looks in the current directory and then in the list of directories given in the PATH.

If you install a bunch of compilers, you may run into the problem of having a PATH that is too big; for example, 32-bit Windows does not allow environment variables longer than 2KB (2048 characters).

3/31/2011 8:53:50 PM

clalias
All American
1580 Posts
user info
edit post

^^ follow the link I gave at the top - just add the folder location where the compiler is installed. note this might be in a /bin sub-directory or something.

If you tired that and it didn't work you may have to restart the comp for it to take effect.

Unfortunately, there aren't many/any free windows fortran compilers. Linux yes, windows no.

3/31/2011 9:22:17 PM

Lionheart
I'm Eggscellent
12776 Posts
user info
edit post

Quote :
"a large portion of nuclear reactor practical coding is still done in fortran"

Quote :
"is there an idiot-proof fortran compiler out there for the clueless or at least a FORTRAN COMPILERS FOR DUMMIES guide"

4/1/2011 2:42:37 PM

FenderFreek
All American
2805 Posts
user info
edit post

Nuke programmers gotta start somewhere, right?

4/1/2011 3:01:01 PM

clalias
All American
1580 Posts
user info
edit post

ha!

To be fair, I've met some amazing fortran programmers that don't know anything about compiling or operating system environments. But they write some of the most complicated scientific code there is.

go figure.

4/1/2011 5:47:32 PM

paerabol
All American
17118 Posts
user info
edit post

hey look

i figured it out thankyouverymuch

and it's not the programming i have issue with, it's the virtual semantics


^yeah that, not to imply in any way that i'm an amazing programmer. i know my way around java, a bit o' c++, some pearl and i get assembly. never had to mess with fortran until i switched to NE

4/1/2011 8:40:40 PM

 Message Boards » Tech Talk » fortran compiler help Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.