Using GCC for openEuler
Compiling and Running the C Program
The following uses hello.c as an example.
hello.c code
1 2 3 4 5 6 | #include <stdio.h> int main() { printf("Hello, World!\n"); return 0; } |
1 2 | gcc hello.c -o hello.out ./hello.out |
Compiling and Running the Fortran Program
The following uses hello.f90 as an example. The code is as follows:
1 2 3 4 | program main Implicit none write(*,*) "Hello World!" end program main |
1 2 | gfortran hello.f90 -o hello.out ./hello.out |
GCC for openEuler is based on the open-source GCC, so they share the same methods in using the gcc, g++, and gfortran commands.
Parent topic: Installing and Using GCC for openEuler