【问题标题】:Getting following error "collect2: ld returned 1 exit status"出现以下错误“collect2:ld 返回 1 退出状态”
【发布时间】:2010-10-14 11:59:52
【问题描述】:

我使用其他源文件中的模块创建了一个 C 源文件。假设创建的源文件是 abc.c 。我的 C 文件使用以下命令编译良好。

gcc -c  abc.c 

我已经编译了每个链接到 abc.c 的源文件。同时使用以下命令创建可执行文件:

 gcc abc.o b.o c.o ....strings.o -o abc

它显示以下错误,尽管我使用 strings.o 来创建可执行文件:

strings.o: In function `string_IntToString':
strings.c:(.text+0x5d3): undefined reference to `log10'
strings.c:(.text+0x606): undefined reference to `log10'
collect2: ld returned 1 exit status

你能建议我这里有什么问题吗?

【问题讨论】:

    标签: c compiler-construction libm


    【解决方案1】:

    您忘记链接 libm。

    gcc ... -lm ...
    

    【讨论】:

      猜你喜欢
      • 2014-09-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-12
      • 2011-08-26
      • 1970-01-01
      相关资源
      最近更新 更多