0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

OSXのC言語でsha1の計算をしようしたらコンパイルエラーが出た時の対処法

Posted at

#include <openssl/sha.h>を使ってsha1の計算をしようとしたらコンパイルエラーが出ました。

Undefined symbols for architecture x86_64:
  "_SHA1_Final", referenced from:
      _calc_sha1 in sha1-8b90d3.o
  "_SHA1_Init", referenced from:
      _calc_sha1 in sha1-8b90d3.o
  "_SHA1_Update", referenced from:
      _calc_sha1 in sha1-8b90d3.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

対処法

コンパイルするときに-lcryptoを指定したら解決しました。

gcc -lssl -lcrypto sha1.c

(Linuxだと-lsslだけでいけた気がするんだけど、なんでだろう...)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?