1

cat main.c

#include <stdio.h>
#include <stdlib.h>
#include <linux/ext2_fs.h>

int main(int argc, char** argv) {

    return (EXIT_SUCCESS);
}

Here is my output...

gcc main.c In file included from main.c:3:

/usr/include/linux/ext2_fs.h: In function ‘ext2_mask_flags’:

/usr/include/linux/ext2_fs.h:182: error: ‘FS_DIRSYNC_FL’ undeclared (first use in this function)

/usr/include/linux/ext2_fs.h:182: error: (Each undeclared identifier is reported only once

/usr/include/linux/ext2_fs.h:182: error: for each function it appears in.)

/usr/include/linux/ext2_fs.h:182: error: ‘FS_TOPDIR_FL’ undeclared (first use in this function)

/usr/include/linux/ext2_fs.h:184: error: ‘FS_NODUMP_FL’ undeclared (first use in this function)

/usr/include/linux/ext2_fs.h:184: error: ‘FS_NOATIME_FL’ undeclared (first use in this function)

If I remove #include <linux/ext2_fs.h> the program compiles successfully...

Bart
  • 19,692
  • 7
  • 68
  • 77
Eric Fossum
  • 2,395
  • 4
  • 26
  • 50

4 Answers4

4

You need to add #include <linux/fs.h>

Bart
  • 19,692
  • 7
  • 68
  • 77
2

You need to add #include <linux/fs.h> before including the #include <linux/ext2_fs.h>

Nainesh
  • 21
  • 1
  • Providing new answers, that provide no new information, to old threads is of little value to future users. ;( – vdbuilder Oct 28 '12 at 01:05
0

I fixed it with:

#include <sys/stat.h>
#include <linux/fs.h>
FRGH
  • 1
0

I had no idea, so I put ext2_fs.h into Google and this was the 4th result.

The behaviour seems to be considered a bug.

Karl Knechtel
  • 62,466
  • 11
  • 102
  • 153
  • Definitely looked, but I guess I didn't use my Google force skillz. Still didn't help too much, compiler won't recognize ext2_super_block – Eric Fossum Aug 06 '11 at 22:42