I am trying to compile a program but GCC shows an error in it. I looked around and the code looks perfectly valid to me. Can you tell what's wrong?
Code:
/*
Linked List of Text Lines For Use with Text Editors
*/
#include <stdio.h> //For File I/O
#include <stdlib.h> //For malloc(), etc.
#include <string.h> //Array Manipulation Functions
struct linked_line { // Linked Line Structure
char* text = NULL;
unsigned long alloc = 0;
unsigned long len = 0;
struct linked_line* prev = NULL;
struct linked_line* next = NULL;
};
typedef struct linked_line LINKED_LINE;
#define LL_ALLOC_STEP 1024 //Line memory allocation step
LINKED_LINE* ll_new(); //Create new blank line
LINKED_LINE* ll_new(FILE* file); //Create new list of lines from file
void ll_realloc(LINKED_LINE* ll, unsigned long num_chars); //Reallocate in steps
void ll_squash(LINKED_LINE* ll); //Reallocate to just enough room
unsigned long ll_get_line_num(LINKED_LINE* ll); //Get number of line
unsigned long ll_get_line_count(LINKED_LINE* ll); //Get amount of lines
void ll_ins_char(LINKED_LINE* ll, char c, unsigned long col; //Insert character
void ll_ins_line(LINKED_LINE* ll); //Insert line
void ll_ins_str(LINKED_LINE* ll, char* str, unsigned long col); //Insert string
void ll_merge_lines(LINKED_LINE *ll); //Merge lines
void ll_split_line(LINKED_LINE *ll, unsigned long col); //Split line
Error Message:
Code:
$ gcc editor2.c linked-line.c -lncurses
In file included from editor2.c:2:
linked-line.h:10: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
editor2.c:4: error: expected declaration specifiers or ‘...’ before ‘wprint_ll’
In file included from linked-line.c:1:
linked-line.h:10: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
linked-line.c:4: error: expected ‘;’, ‘,’ or ‘)’ before ‘{’ token