我尝试使用 Eina 库的文件模块和经典系统调用。我的问题是当我想使用 eina 以及 ftw.h 中的一些函数和常量时。
这是第一个简单的代码:
#define _XOPEN_SOURCE 500 /*Get nftw() and S_IFSOCK declarations*/
#include <ftw.h>
#include <stdio.h>
#include <stdlib.h>
#include <Eina.h>
/*Compile with
gcc -o eina_ftw eina_ftw.c $(pkg-config --libs --cflags eina)
*/
int main(int argc, char **argv)
{
int a = FTW_DNR;
int b=0;
b = FTW_MOUNT;
printf("ok\n");
exit(EXIT_SUCCESS);
}
当我编译它时,我有这些错误:
In file included from /usr/include/eina-1/eina/eina_lock.h:50:0,
from /usr/include/eina-1/Eina.h:259,
from eina_ftw.c:5:
/usr/include/eina-1/eina/eina_inline_lock_posix.x:57:1: erreur: unknown type name thread_spinlock_t’
typedef pthread_spinlock_t Eina_Spinlock;
^
/usr/include/eina-1/eina/eina_inline_lock_posix.x:561:4: erreur: unknown type name ‘pthread_barrier_t’
pthread_barrier_t barrier;
^
好的,所以我尝试了这个:
#include <Eina.h>
#define _XOPEN_SOURCE 500 /*Get nftw() and S_IFSOCK declarations*/
#include <ftw.h>
#include <stdio.h>
#include <stdlib.h>
/*Compile with
gcc -o eina_ftw eina_ftw.c $(pkg-config --libs --cflags eina)
*/
int main(int argc, char **argv)
{
int a = FTW_DNR;
int b=0;
b = FTW_MOUNT;
printf("ok\n");
exit(EXIT_SUCCESS);
}
现在我有这种错误:
eina_ftw.c: In function ‘main’:
eina_ftw.c:13:7: erreur: ‘FTW_MOUNT’ undeclared (first use in this function)
b = FTW_MOUNT;
^
eina_ftw.c:13:7: note: each undeclared identifier is reported only once for each function it appears in
所以我想知道是否有办法解决这个问题?