Compiled Language¶
Attention
At this time, you can skip this step and come back to learn one complied language when you need it.
You need at least master one compiled language. The most popular compiled languages used in seismology community are C, Fortran, C++ and Java.
For beginners, C or Fortran are the best choices. You need to know the basic grammar of a programming language and how to compile/run a program.
For a program written in C or Fortran, you need follow the steps to run the program:
Write the source codes using the correct syntax
Compile the source codes to a executable file, using a compiler (
gcc
for C,gfortran
for Fortran)Run the executable file
To compile source codes to a executable file, you need to know some commonly used options for gcc and gfortran, such as -c
, -o
, -g
, -I
, -L
, -l
. It would be easier to solve some compilation errors if you have a basic understanding of the compiling, linking and executing for compiled languages.
You also need to learn how to read and write a Makefile, which is a tool to automatize the compiling process for a large source codes with multiple executable files. Please refer to 跟我一起写 Makefile.