How to link gfortran when I compile?

I use ubuntu 12.04, my Makefile FC:gfortran, but I couldn't compile, I checked on it, it installed(my gcc upgraded from 4.6.3 to 4.7) How do I link to it?

I tried pkg-config --cflags --lib gfortran or gtkxxx, it says not in the pkg_config_path

I checked gfortran: COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' -with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu


You don't need pkg-config to use gfortran ; you just need to compile and link with the gfortran executable (and you can also use gfortran to link C code with Fortran code, and you could probably link using gcc with -lgfortran )

BTW, pkg-config accepts the --list-all option; with the command

pkg-config --list-all |grep -i gtk

you can understand that GTK is in fact gtk+-x11-3.0

You should also read the documentation of GFORTRAN; it has a chapter about mixed-language-programming

Of course you need to install the gfortran , gfortran-4.7 and libgfortran-4.7-dev packages

链接地址: http://www.djcxy.com/p/86904.html

上一篇: 交叉编译arm的静态libnuma

下一篇: 编译时如何链接gfortran?