I am trying to develop some additional features https://github.com/ffnord/alfred/blob/master/vis/vis.c
Since I am not familiar with Linux lists (list.h), I tried to follow this list.h tutorial . To do this, I created a very simple test.c file, and I also imported the mentioned list.h file batman / alfred (via openmesh).
Alfred / batman Github code compiles flawlessly, but in the sample code GCC complains about list.h.
Description Resource Path Location Type
expected ‘;’ before ‘}’ token list.h /C_Linux_kernel_lists/src line 68 C/C++ Problem
Description Resource Path Location Type
lvalue required as unary ‘&’ operand list.h /C_Linux_kernel_lists/src line 68 C/C++ Problem
So my question is: why does GCC not complain about the list.h upstream code and it returns me these messages when I try to use the same code?
Attached Code:
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
struct Person
{
char name[30];
unsigned int weight;
unsigned char gender;
struct list_head list;
};
int main()
{
struct Person personList;
LIST_HEAD_INIT(&personList.list);
struct Person* aNewPersonPointer;
aNewPersonPointer = malloc(sizeof(*aNewPersonPointer));
strcpt(aNewPersonPointer->name, "roman10");
aNewPersonPointer->weight = 130;
aNewPersonPointer->gender = 1;
INIT_LIST_HEAD(&aNewPersonPointer->list);
list_add(&aNewPersonPointer->list, &personList.list);
return 0;
}