Bugs of this type are frequent and normally very easy to find.

Just make sure not to forget to include all files that are needed for your project, and also make it a habit to check the return value of file-dependent functions, such as ent_create or file_open.