You’re looking for
g++ main.o print_hi.o -o main -lgfortran
to link in the standard Fortran libraries.
You can also use gfortran
by passing -lstdc++
.
More Related Contents:
- Selectively disable GCC warnings for only part of a translation unit
- How to get rid of `deprecated conversion from string constant to ‘char*’` warnings in GCC?
- Dual emission of constructor symbols
- Why does typeid.name() return weird characters using GCC and how to make it print unmangled names?
- Are function static variables thread-safe in GCC?
- gcc/g++: “No such file or directory”
- Array with size 0 [duplicate]
- What is the first (int (*)(…))0 vtable entry in the output of g++ -fdump-class-hierarchy?
- Is std::string ref-counted in GCC 4.x / C++11?
- Why does GCC generate 15-20% faster code if I optimize for size instead of speed?
- Why does the enhanced GCC 6 optimizer break practical C++ code?
- Precompiled headers with GCC
- What is the difference between MinGW, MinGW-w64 and MinGW-builds?
- Compiling with -static-libgcc -static-libstdc++ still results in dynamic dependency on libc.so
- std::put_time implementation status in GCC?
- GNU C++ how to check when -std=c++0x is in effect?
- Does a c/c++ compiler optimize constant divisions by power-of-two value into shifts?
- Template instantiation details of GCC and MS compilers
- Which types on a 64-bit computer are naturally atomic in gnu C and gnu C++? — meaning they have atomic reads, and atomic writes
- STL analogue in Fortran
- Pass arrays from C/C++ to Fortran and return a calculated array
- Does the restrict keyword provide significant benefits in gcc/g++?
- std::thread error (thread not member of std)
- Using pre-compiled headers with CMake
- Use of ‘auto func(int)’ before deduction of ‘auto’ in C++14
- Injected class name compiler discrepancy
- Preventing GCC from automatically using AVX and FMA instructions when compiled with -mavx and -mfma
- C++ uniform_int_distribution always returning min() on first invocation
- Can I make GCC warn on passing too-wide types to functions?
- How do I run the preprocessor on local headers only?