Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[HELP] GCCで構造体が使用できない。

603 views
Skip to first unread message

Kunio Fujiwara

unread,
Jan 26, 2000, 3:00:00 AM1/26/00
to
LinuxのIncludeファイルのfs.hで定義されている構造体を使用しようとしているので
すがコンパイルをかけると次のエラーが発生してコンパイルできません。
”コンパイラのオプション設定の問題じゃない?”との情報をもらったので、コンパ
イラのヘルプを見たのですが該当するような設定は見当たりませんでした。
Turbo Linux上ででコンパイラはGCCを使用しています。

ご存知の方がおられましたらよろしくお願いします。

>>---------- エラーの内容 ----------<<
variable 'hoge_hops' has initializer but incomplete type.
(エラーのラインは私のプログラムの"static struct file_operations hoge_fops="
の行で発生。)

>>---------- hs.hから抜粋 ----------<<
struct file_operations {
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
int (*readdir) (struct file *, void *, filldir_t);
unsigned int (*poll) (struct file *, struct poll_table_struct *);
int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned
long);
int (*mmap) (struct file *, struct vm_area_struct *);
int (*open) (struct inode *, struct file *);
int (*flush) (struct file *);
int (*release) (struct inode *, struct file *);
int (*fsync) (struct file *, struct dentry *);
int (*fasync) (int, struct file *, int);
int (*lock) (struct file *, int, struct file_lock *);
};

>>---------- 私のプログラム ----------<<
static struct file_operations hoge_fops=
{
NULL, /* lseek */
hoge_read, /* read */
hoge_write, /* write */
NULL, /* readdir */
NULL, /* selcect */
NULL, /* ioctrl */
NULL, /* mmap */
hoge_open, /* open */
NULL, /* flush */
hoge_release, /* release */
NULL, /* fsync */
NULL, /* fasync */
NULL /* lock */
};

tesi...@mtf.biglobe.ne.jp

unread,
Jan 27, 2000, 3:00:00 AM1/27/00
to
"Kunio Fujiwara" <f-k...@mbox.kyoto-inet.or.jp> writes:

>LinuxのIncludeファイルのfs.hで定義されている構造体を使用しようとしているので
>すがコンパイルをかけると次のエラーが発生してコンパイルできません。
>”コンパイラのオプション設定の問題じゃない?”との情報をもらったので、コンパ
>イラのヘルプを見たのですが該当するような設定は見当たりませんでした。
>Turbo Linux上ででコンパイラはGCCを使用しています。
>
>ご存知の方がおられましたらよろしくお願いします。
>
>>>---------- エラーの内容 ----------<<
>variable 'hoge_hops' has initializer but incomplete type.
>(エラーのラインは私のプログラムの"static struct file_operations hoge_fops="
>の行で発生。)

良く分かんないですが、

% gcc -E ほげほげ.c | grep '^[ ]*$'

の結果に struct file_operations の定義はありますか?
__KERNEL__ を定義しないと宣言されないように見えますが、
それは丈夫ですか?
---------------------------------------------------------------------
tesi...@mtf.biglobe.ne.jp

tesi...@mtf.biglobe.ne.jp

unread,
Jan 28, 2000, 3:00:00 AM1/28/00
to
tesi...@mtf.biglobe.ne.jp (tesi...@mtf.biglobe.ne.jp) writes:

> 良く分かんないですが、
>
> % gcc -E ほげほげ.c | grep '^[ ]*$'

すみません、

% gcc -E ほげほげ.c | grep -v '[ ]*$'

でした。
---------------------------------------------------------------------
tesi...@mtf.biglobe.ne.jp

Sakurada Kouji

unread,
Feb 14, 2000, 3:00:00 AM2/14/00
to
ちょっとよく分かりませんが、

>>>---------- hs.hから抜粋 ----------<<
>struct file_operations {
> ssize_t (*read) (struct file *, char *, size_t, loff_t *);
> ssize_t (*write) (struct file *, const char *, size_t, loff_t *);

hoge_read, /* read */
hoge_write, /* write */
は全く同じ型のでしょうか?
もし違っていれば、

>variable 'hoge_hops' has initializer but incomplete type.
というエラーが出てもおかしくない気がします。。

0 new messages