0

私はコードをもっている:

struct hostent *hp = gethostbyname(dns.c_str());

私のアプリで。すべてを静的にリンクするUbuntuサーバーでコンパイルします。すべて問題ありませんが、CentOS でこのアプリを起動しようとすると、この gethostbyname 呼び出しでエラーが発生します。

浮動小数点例外

それを修正する方法を教えてもらえますか?ありがとう!

4

1 に答える 1

2

static linking considered harmful http://www.akkadia.org/drepper/no_static_linking.html

"all kinds of features in the libc (locale (through iconv), NSS, IDN, ...) require dynamic linking to load the appropriate external code."

于 2013-02-19T17:25:04.960 に答える