在Ubuntu下的CodeBlocks中将gfortran库链接到c ++程序 [英] Linking gfortran libraries to c++ program in CodeBlocks under Ubuntu

查看:235
本文介绍了在Ubuntu下的CodeBlocks中将gfortran库链接到c ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Vmware下有一个Ubuntu,并使用Code :: Blocks,因为我不是一个非常强大的命令行用户
,并且更喜欢IDE到Vim + console。



我试图编译一个使用c ++ wrapper来fortran库的程序。
然而编译给了我以下错误:

$ p $ 对`_gfortran_compare_string'的未定义引用

这种类型的错误很多,而其他类似的错误也很多。



我有gfortran 4.6.3。我发现搜索它可能是一个链接问题,并且人们说
使用链接器的-lgfortran选项。当我将这添加到Code :: Blocks中的链接器选项时,它不会改变任何内容,错误会继续。所以,这里有一些问题:


  1. 这是链接器的正确选项吗?

  2. 可能我必须为链接器提供一个直接访问fortran库的路径吗?

  3. 如何查找fortran库的安装位置? (我对Linux没有太多了解((()

  4. 我做错了什么以及如何解决它。


解决方案

我的猜测类似于/ bin / lib / usr / lib或/ usr / local / lib,只要看看你的文件系统。没有Linuix的工作,也许是其他人?



Kim Kulling


I have an Ubuntu under Vmware, and use Code::Blocks, as I am not a very powerful command line user and prefer IDE to Vim+console.

I am trying to compile a program which uses a c++ wrapper to fortran library. However compiling gives me the following errors:

undefined reference to `_gfortran_compare_string'

There are a lot of errors of this type and a bunch of other similar to this one.

I have gfortran 4.6.3. I found searching that it is probably a linking problem, and people say to use -lgfortran option for linker. When I add this to linker options in the Code::Blocks it does not change anything, errors continue. So, here are some question:

  1. Is this a correct option for linker?
  2. May be I have to give linker a direct path to the fortran library?
  3. How do I find where are the fortran libraries installed? (I don't know a lot about linux ((( )
  4. What am I doing wrong and how to fix it.

解决方案

My guess is something like /bin/lib /usr/lib or /usr/local/lib. Just take a look into your filesystem. Unfortunately I do not have a Linuix at work. Maybe someone else?

Kim Kulling

这篇关于在Ubuntu下的CodeBlocks中将gfortran库链接到c ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆