Help with compiling C program, syntax error
Hi group,
I have a small problem with compiling a program. Here is the failing code: Code:
/* c_lflag bits */ Code:
gcc -g -I. showtty.c -o showtty |
Quote:
I expect what you intend is what you would have if you remove the "typdef" and add a ";" after "}" Code:
/* c_lflag bits */ |
Just continuing the line of thought that johnsfine presented...
If you want to retain the type definition, then: Code:
/* c_lflag bits */ |
Quote:
When I was fixing some code to make it compile with a newer version of GCC, I needed to remove "typedef" from several constructs that I'm pretty sure were equivalent to what you have above. |
Thanks
Thanks guys, here is what I got to work:
Code:
makeflag c_lflag.c;a.out |
Quote:
Once one has the type defined, declaring instances and initializing them becomes quite simple. I also prefer to place type definitions in header files but that is a style preference. |
K&R isn't ansi though, typically if you want to typedef a struct on the same line you either have an anonymous struct or another name for the struct
Code:
typedef struct _LFlag_ { |
Quote:
|
All times are GMT -5. The time now is 12:13 AM. |