schlussel回答ポイント 100ptウォッチ

現在、Fedora 11でソケットプログラミングの学習を行っています。


http://ash.jp/net/prog_net.htm

上記のWebページに掲載されているC言語版の"hellosv.c","hellocl.c","makefile"を同一のディレクトリ下にダウンロードし、"make all"を実行したところ以下のようなエラーが発生し上手くコンパイルすることができません。

cc -o hellosv hellosv.c -lsocket -lnsl -dn
cc1: 警告: 認識できない gcc デバッグオプション: n
hellosv.c: In function ‘main’:
hellosv.c:45: 警告: incompatible implicit declaration of built-in function ‘bzero’
hellosv.c:48: 警告: incompatible implicit declaration of built-in function ‘memcpy’
hellosv.c:50: 警告: passing argument 2 of ‘bind’ from incompatible pointer type
/usr/include/sys/socket.h:115: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
hellosv.c:66: 警告: passing argument 2 of ‘accept’ from incompatible pointer type
/usr/include/sys/socket.h:214: note: expected ‘struct sockaddr * __restrict__’ but argument is of type ‘struct sockaddr_in *’
hellosv.c:85: 警告: incompatible implicit declaration of built-in function ‘exit’
/usr/bin/ld: cannot find -lsocket
collect2: ld はステータス 1 で終了しました
make: *** [hellosv] エラー 1

解決方法をご教示いただけないでしょうか?

※ 有料アンケート・ポイント付き質問機能は2023年2月28日に終了しました。
ログインして回答する

ベストアンサー

その他の回答

この質問へのコメント

この質問への反応(ブックマークコメント)

質問の情報

登録日時
2009-06-15 22:26:58
終了日時
2009-06-16 20:52:03
回答条件
1人2回まで

この質問のカテゴリ

この質問に含まれるキーワード

Makefile39C言語303Fedora89gcc113デバッグ204コンパイル428Make:39プログラミング1135ディレクトリ1525const51オプション1258ダウンロード5105EXIT194CC248accept45

人気の質問

メニュー

PC版