1

尝试在小型 c 组中启动 cgroups 时,出现以下错误

 In file included from /usr/include/libcgroup.h:24:0,
                 from simple_cgroup.h:28,
                  from simple_cgroup.cc:1: /usr/include/libcgroup/groups.h:108:8: error: forward declaration of
 ‘struct cgroup’  struct cgroup;

使用这些标头的代码是

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>
#include <pthread.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sched.h> 
#include <string.h>
#include <unistd.h> 
#include <libcgroup.h>

我使用带有 -lcgroup 标志的 g++ 进行编译。

对于为什么会发生这种情况,我们非常感谢帮助

4

0 回答 0