Problem mit Variablendekleration

Philipp Otte <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
Hi,
ich habe folgendes Problem. Ich schreibe ein Programm, dass den
ELF-Header einer ELF-Datei ausliest.
Das Programm liegt aufs Problem gestutzt als Anhang dabei.
Dabei gibt mir der gcc folgende Fehlermeldung aus:

philipp@philipp:~$ gcc -o elftest elftest.c
elftest.c: In Funktion »main«:
elftest.c:8: error: storage size of `header' isn't known
elftest.c:13: error: invalid application of `sizeof' to an incomplete
type

Wieso weiß der gcc nicht, wie groß Elf32_Ehdr ist?

Ich hoffe auf Antworten.
philipp
elftest.c (text/x-csrc, 325 B)
#include <stdio.h>
#include <sys/types.h>
#include <elf.h>

int main(int argc, char* argv[])
{
	FILE *file = NULL;
	struct Elf32_Ehdr header;
	
	file = fopen(argv[2], "r");
	if (file == NULL)
		perror("fopen\n");
	if (fread(&header, sizeof(struct Elf32_Ehdr), 1, file) != 1)
		perror("fread\n");
	return 0;
}
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBCtzInPPwLyJcVxnURAnN6AJ9bCh0rYXvMpfypZ98cNhLDxl0GnwCfbn3r
XTbZcMMUgNhbcQicriIiHVA=
=8Sqt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.