Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to write files for compiling a program.? Post 302810741 by Corona688 on Wednesday 22nd of May 2013 12:50:23 PM
Old 05-22-2013
I'm pretty sure .f files are Fortran, no relation to the C shell or any other shell.

If you have gcc fortran, I think you would do
Code:
gfortran file.f -o file

Perhaps more than one .f file would need to be listed for a complete program, depends on the program.

You can also take two steps, and do
Code:
gfortran -c file.f
gfortran file.o -o file

Makefiles are pretty simple in the end, you tell them what files are made from what files.

With this file named Makefile in the same directory, run make:

Code:
# Rule that converts any .f files into .o files
%.o : %.f
        gfortran -c %< -o %@

# Convert these four .o files into one executable
program:a.o b.o c.o d.o
        gfortran a.o b.o c.o d.o -O program

Note that things with eight space in front here are actually tabs and MUST BE tabs.

Last edited by Corona688; 05-22-2013 at 02:00 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

Error Compiling C program

Hi All, I tried to compile a C program but i am getting error while Linking . it says Undefined reference to ' ' (here it gives a method name which is defined Globally ). Can any body tell the resaon and remedy for the same . Iam stuck up here . Thanks (3 Replies)
Discussion started by: Vivek
3 Replies

2. Programming

Compiling a program

Hello. I am trying to run a c program on a unix shell (ssh). I have searched this forum but have not come accross the soultion to my problem, so I am posting my question here :cool: I wrote the following simple code: #include <iostream.h> using namespace std; int main() { ... (7 Replies)
Discussion started by: Minnesota Red
7 Replies

3. Programming

Problem compiling program

hi i am having a problem that when ever i use cc program_name.c to compile a program. an error occurs, showing cc not found. please help. (28 Replies)
Discussion started by: rochitsharma
28 Replies

4. Programming

Compiling a C program

Help I know nothing about c programming. :confused: I want to compile the below c program. It extracts data from an oracle database into csv files. I have oracle 9206 installed with ProC. I dont have gcc My question is. How the hell do I make this into an file I can run? I am pulling... (3 Replies)
Discussion started by: ooploo
3 Replies

5. Programming

help on compiling a C program on Tiger

here is the very simple bob.c: main() { printf("hello"); } i use tiger and i use the command: gcc bob.c and the end result: bob.c: In function ‘main': bob.c:3: warning: incompatible implicit declaration of built-in function /‘printf' any help appreciated, i'm just starting... (4 Replies)
Discussion started by: cleansing_flame
4 Replies

6. Programming

compiling c program in unix

if somebody can help me pls. i need the source code for a shell which compiles C or java programs in unix i need a very short and simple one, just the compiling part Respect (2 Replies)
Discussion started by: zlatan005
2 Replies

7. Shell Programming and Scripting

Write an automated shell program(s) that can create, monitor the log files and report the issues for

Hi , Please help me getting this done. Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for... (1 Reply)
Discussion started by: itian2010
1 Replies

8. Programming

Problems compiling OpenStep program.

I use Ubuntu 10.4, and I installed GNUStep, Gorm (a gui builder) and ProjectCenter (the GNU alternative to Xcode) because I want to develop Objective-C apps. I opened the ProjectCenter and I created an application that displays only an empty window. I sourced the GNUstep.sh and I compiled the app. ... (0 Replies)
Discussion started by: mghis
0 Replies

9. UNIX for Dummies Questions & Answers

write a program in c in unix that display the files(includ sub-direc and files within) in a sorted

the sorting is based on name of file, file size modification time stamps o f file it should dislay the output in the following format "." and ".." enteries should be ignored please give some idea how to do it (1 Reply)
Discussion started by: pappu kumar jha
1 Replies

10. Programming

compiling old C program in Linux.

Hello, I am writing to ask for support about compiling an very old but famous C-progam for genetics study called MapMaker/QTL, and the source code is available from MIT: http://www.broadinstitute.org/ftp/distribution/software/mapmaker3/The program was originally designed for systems like SunOS... (1 Reply)
Discussion started by: yifangt
1 Replies
FCASPLIT(1)						      General Commands Manual						       FCASPLIT(1)

NAME
fcasplit - tool to split source code into separate per-routine files SYNOPSIS
fcasplit [ -f nmft ] [ -c nmcc ] [ -a nmas ] [-noh] [-log] [ +fo incf ] [ +co incc ] [ +ao incs ] [ -fo optf ] [ -co optc ] [ -ao opts ] file.ext fcasplit file.ext [ fca_n ] [ optf [ optc [ opts [ nmft [ nmcc [ nmas ]]]]]] DESCRIPTION
fcasplit, used with a command line of either form shown above, splits file file.ext having a mixture of FORTRAN / C / assembler routines into separate files n.f or n.c or n.s, "n" being the name of each routine, creating at the same time a shell script file.shfca and a Make file file.mkfca either of which can be used to compile all routines individually. All new files are generated in the current directory, even if the original file.ext is in a different location. NOTE that the program does not work on source code written without having it in mind, since fcasplit looks for special identifying lines in comments of the source code in the original file, as noted below. It is able to operate, for instance, on source code output by nypatchy. Defaults are defined in fcasplit for the names by which the compilers are called in the generated shell script and Makefile; with the -f, -c, -a options they could be changed. In Debian GNU/Linux, these defaults are gcc for the C compiler, gfortran for the FORTRAN compiler, and as for the assembler. Defaults are also defined for the options with which they are called; with the -fo, -co, -ao options they can be re-defined; with the +fo, +co, +ao options they can be incremented. In Debian GNU/Linux, these defaults are "-c -g -O2" for the C compiler, "-c -g -O2 -fno-auto- matic" for the FORTRAN compiler, and "" (i.e., no flags) for the assembler. To be backward compatible these options can also be specified by the positional parameters after the file-name (as in the second form of the command shown above). If the -noh option is given (or if the first parameter after the file-name is "fca_n") the identifying header line of each routine is not written out. If the -log option is given the name of each routine is printed on standard output. FILE FORMAT
Each routine in the original file file.ext must start with an identifying line: "CDECK ID>, " in cols. 1-12 for FORTRAN "/*DECK ID>, " in cols. 1-12 for C ";DECK ID>, " in cols. 1-12 for assembler "DECK ID>, " in cols. 2-12 or "DECK ID>, " in cols. 3-12 for anything else "name" in cols. 13-40 gives the name In the last two cases, or if "name" contains an extension, the file created will be "name" without extension .f, .c or .s added to it and without an entry into the script. A trailing blank terminates the name, symbol . followed by blank also terminates, symbols ; < # ! all terminate, symbol */ also terminates. SEE ALSO
nycheck(1), nydiff(1), nyindex(1), nylist(1), nymerge(1), nypatchy(1), nyshell(1), nysynopt(1), nytidy(1), yexpand(1) The reference manual for the Nypatchy suite of programs is available in compressed PostScript format at the following URL: http://wwwasdoc.web.cern.ch/wwwasdoc/psdir/p5refman.ps.gz AUTHOR
This manual page was written by Kevin McCarty <kmccarty@debian.org> for the Debian GNU/Linux system (but may be used by others), based on the help information printed by the fcasplit program when called with no arguments. Both fcasplit and this man page are licensed under the GNU General Public License, version 2 or later (at your choice). COPYRIGHT
Copyright (C) CERN, 1996, 1999 and Kevin B. McCarty, 2008. Mar 12, 2008 FCASPLIT(1)
All times are GMT -4. The time now is 12:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy