• 締切済み

C言語の画像抽出

C言語のプログラムをコンパイルした時に ”/tmp/cchzThVk.o: In function 'c_to_sh': 5.c:(.text+0x5b3): undefined reference to 'sqrt' 5.c:(.text+0x64e): undefined reference to 'atan2' collect2: Id は ステータス1で終了しました。” とメッセージが出るのですが、このメッセージが出たときはプログラムにミスがあるということなのでしょうか。教えてくださいお願いします。

みんなの回答

  • izuminv
  • ベストアンサー率0% (0/3)
回答No.1

ぱっと見た感じ、数学関係のライブラリ(math.libとか名前のライブラリ)をリンクしてないだけじゃないでしょうか。

関連するQ&A

  • c言語 コンパイルエラー

    以下webページに載っているC言語のプログラムをコンパイルした時に ”/tmp/cchzThVk.o: In function 'c_to_sh': 5.c:(.text+0x5b3): undefined reference to 'sqrt' 5.c:(.text+0x64e): undefined reference to 'atan2' collect2: Id は ステータス1で終了しました。” とメッセージが出るのですが、このメッセージが出たときはプログラムにミスがあるということなのでしょうか。教えてくださいお願いします。 http://plaza.rakuten.co.jp/dragonkkk

  • C言語プログラムの質問なんですが、エラーが出てコンパイルできません。

    C言語プログラムの質問なんですが、エラーが出てコンパイルできません。 エラーメッセージ /tmp/ccGHoP41.o: In function `main': step1-7.c:(.text+0x39): undefined reference to `stringStdin' collect2: ld returned 1 exit status 何が間違ってるのか全くわからない状態です。 どなたかアドバイスお願いします!

  • C言語

    コンパイルしたときに /tmp/cceF11bH.o(.txet+0*1de):ln function 'hilbert.'0 : : undefined reference to 'hilbert' collect2 :ld はステータス1 で終了しました と表示されます。 どういう意味でしょうか?

  • PostgreSQLをC言語でアクセスしようと

    PostgreSQL 8.4.8 文書にのっているサンプルプログラムの 例 30-1. libpq サンプルプログラム 1 #include <stdio.h> #include <stdlib.h> #include "libpq-fe.h" ・・・・・・・・・・・・・ をコピペしてコンパイルしたところ次のようなエラーがでました # gcc sample.c /tmp/cctZBolQ.o: In function `exit_nicely': sample.c:(.text+0xd): undefined reference to `PQfinish' /tmp/cctZBolQ.o: In function `main': sample.c:(.text+0x4a): undefined reference to `PQconnectdb' sample.c:(.text+0x5a): undefined reference to `PQstatus' sample.c:(.text+0x6a): undefined reference to `PQerrorMessage' sample.c:(.text+0xa5): undefined reference to `PQexec' sample.c:(.text+0xb5): undefined reference to `PQresultStatus' sample.c:(.text+0xc6): undefined reference to `PQerrorMessage' sample.c:(.text+0xed): undefined reference to `PQclear' sample.c:(.text+0x105): undefined reference to `PQclear' sample.c:(.text+0x119): undefined reference to `PQexec' sample.c:(.text+0x129): undefined reference to `PQresultStatus' sample.c:(.text+0x13a): undefined reference to `PQerrorMessage' sample.c:(.text+0x161): undefined reference to `PQclear' sample.c:(.text+0x179): undefined reference to `PQclear' sample.c:(.text+0x18d): undefined reference to `PQexec' sample.c:(.text+0x19d): undefined reference to `PQresultStatus' sample.c:(.text+0x1ae): undefined reference to `PQerrorMessage' sample.c:(.text+0x1d5): undefined reference to `PQclear' sample.c:(.text+0x1ed): undefined reference to `PQnfields' sample.c:(.text+0x20f): undefined reference to `PQfname' sample.c:(.text+0x26b): undefined reference to `PQgetvalue' sample.c:(.text+0x2a8): undefined reference to `PQntuples' sample.c:(.text+0x2ba): undefined reference to `PQclear' sample.c:(.text+0x2ce): undefined reference to `PQexec' sample.c:(.text+0x2de): undefined reference to `PQclear' sample.c:(.text+0x2f2): undefined reference to `PQexec' sample.c:(.text+0x302): undefined reference to `PQclear' sample.c:(.text+0x30e): undefined reference to `PQfinish' collect2: ld はステータス 1 で終了しました # # find /usr/include/ -name libpq*.h /usr/include/pgsql/internal/libpq-int.h /usr/include/pgsql/server/libpq/libpq-be.h /usr/include/pgsql/server/libpq/libpq.h /usr/include/pgsql/server/libpq/libpq-fs.h /usr/include/libpq/libpq-fs.h /usr/include/libpq-events.h /usr/include/libpq-fe.h # gcc -I/usr/include sample.c でもおなじです どうすればコンパイル出きるようになるでしょうか? よろしくお願いします

  • プログラミングのコンパイルで・・・・・

    C言語でのコンパイルで /tmp/cckxNO3W.o(.text+0xce): In function `main': : undefined reference to `hukeisan' collect2: ld はステータス 1 で終了しました と出るのですがどうしたらいいですか。教えてください。

  • LinuxのgccのLIBパス? (類似質問)

    Linuxのgccで、LIBのパスを設定する方法が知りたいのですが、gccについて詳しい書籍やサイトがありましたら、教えてください。 例)gcc -I/usr/local/example/include test.c /tmp/ccOFpCBo.o(.text+0x26): In function `main': : undefined reference to `EXAMPLE_1' /tmp/ccOFpCBo.o(.text+0x37): In function `main': : undefined reference to `EXAMPLE_2' /tmp/ccOFpCBo.o(.text+0x48): In function `main': : undefined reference to `EXAMPLE_3' collect2: ld はステータス1で終了しました。 また、ldとはVC6++でいう LINKのことでしょうか?

  • C言語のpow関数の不具合

    linux(ubuntu)の上でgccを使っています。 powの関数がおかしいです。 pow(10,-1)を計算させると正しく1e-1が出力されます。 #include <math.h> #include <stdio.h> int main(void){ double x = -1; printf("%f",pow(10,x)); return 0; } 上記のプログラムを走らせると、 In function "main"; *****.c:(.text+0x2d):undefined reference to 'pow' collect2: ldはステータス1で終了しました。 というエラーメッセージがでます。 なぜかpow関数の中に変数を入れるとプログラムが動きません。

  • <math.h>があるのにsqrtが・・・

    最初にあるプログラムを作っていたのですが、その祭sqrtでエラーが出てしまったので、別にsqrtを使う短いプログラムを作りました。それが以下のものになります。(test3.c) 「 #include<stdio.h> #include<math.h> int main(void){ int atai; double x=2.0; atai=(int)sqrt(x); printf("atai is %c",atai); } 」 sqrtが動作するか確かめる為のものです。このプログラム(test3.c)で以下のエラーが出てしまいました。 「 /tmp/ccqEejZ1.o(.text+0x4d): In function `main': test3.c: undefined reference to `sqrt' collect2: ld はステータス 1 で終了しました 」 ちなみにLinux(Fedora core 4)を使用しています。 初心者ということもありなぜエラーが出るのか分かりません。 ちなみに<math.h>を使用しないプログラムは普通に動作します。 解決方法をご存知の方がいらっしゃいましたらご教授下さいませ。 よろしくお願いします。

  • sqrtを知らないと言われます

    #include <stdio.h> #include <math.h> int main() { double x; for (x=0.0; x<=10.0; x+=1.0){ printf("The square root of %f is %f\n", sqrt(x)); } return 0; } をgcc -lm XXX.cでコンパイルしようとすると XXX.c:関数:'main'内: XXX.c:9:3: 警告:書式'%f'は対応した'double'引数が予期されます[-Wformat]/tmp/ccPq0KS7.o: In function 'main'  XXX.c: (text+0x2d) undefined reference to 'sqrt' collect2: ldはステータス1で終了しました、 となります。相当な素人ですがどなたか問題点をご指摘いただければと存じます。

  • コンパイル時のエラー

    UNIXでサーバー、クライアントのCプログラミングをテキストどおりに書いてコンパイルしたのですが、以下のエラーが出ます。gcc, ccでコンパイルすると以下のようになるのですが、これはどういうことなのでしょうか?何が原因なのでしょうか?よろしくお願いいたします。 gcc unix_server.c /var/tmp/ccvpay1f1.o: In function `main': /var/tmp/ccvpay1f1.o(.text+0x8c): undefined reference to `socket' /var/tmp/ccvpay1f1.o(.text+0x104): undefined reference to `unllnk' /var/tmp/ccvpay1f1.o(.text+0x118): undefined reference to `bind' /var/tmp/ccvpay1f1.o(.text+0x150): undefined reference to `listen' /var/tmp/ccvpay1f1.o(.text+0x1a8): undefined reference to `accept' cc unix_server.c ld: /usr/lib/cmplrs/cc/crtn.o: Error: Unresolved: rindex socket bzero bcopy unllnk bind listen accept

専門家に質問してみよう