Search code examples
cincomplete-typeunused-variables

error: variable 'raw' has initializer but incomplete type. (YES I've searched and read similar questions!)


I am teaching myself C. I have been following the tutorial Here on how to make a text editor using C. I've installed cygwin, and installed the necessary parts based on the tutorial. I got as far as page 2, when I hit a compiler error.

$ make
cc kilo.c -o kilo -Wall -Wextra -pedantic -std=c99
kilo.c: In function ‘enableRawMode’:
kilo.c:33:9: error: variable ‘raw’ has initializer but incomplete type
  struct termois raw = orig_termios;
         ^~~~~~~
kilo.c:33:17: error: storage size of ‘raw’ isn’t known
  struct termois raw = orig_termios;
                 ^~~
kilo.c:33:17: warning: unused variable ‘raw’ [-Wunused-variable]
make: *** [Makefile:2: kilo] Error 1

My code is identical to the code in the tutorial on This Page Because I'm completely new to C I don't completely understand what the problem is, or how to fix it.

I have no idea what I'm doing.


Solution

  • This is a typo: termois should be termios:

    struct termios raw = orig_termios;