ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i am trying to compile a C code, which was earlier built on HP-UX environment with aCC compiler, on my new environment (Linux OEL rel5) which has gcc compiler.
Here is the error that i am stuck up with:
In file included from /usr/local/include/io_util.h:18,
from sc_upiur.c:125:
/cisa/include/ncurses/term.h:698: error: field âOttybâ has incomplete type
/cisa/include/ncurses/term.h:699: error: field âNttybâ has incomplete type
695 typedef struct term { /* describe an actual terminal */
696 TERMTYPE type; /* terminal type description */
697 short Filedes; /* file description being written to */
698 TTY Ottyb, /* original state of the terminal */
699 Nttyb; /* current state of the terminal */
700 int _baudrate; /* used to compute padding */
701 char * _termname; /* used for termname() */
702 } TERMINAL;
Is termios.h included in sc_upiur.c? You need a struct definition for TTY.
edit: It looks like termios.h or termio.h should be included in term.h. On my machine, if struct termio were used instead of struct termios, there would be no definition for struct termio. Can you post your term.h file?
Kevin Barry
I think Kevin is giving you good suggestions for fixing the problem.
Quote:
Originally Posted by pallavibhat89
i am trying to compile a C code, which was earlier built on HP-UX environment
That statement implies you are also wondering why you even have a problem in code that builds correctly elsewhere.
Most sets of headers provided with C compilers have incorrect overlap. For example, in addition to the headers that should define TTY, there may be other headers that define TTY, even though technically they shouldn't.
So your code might include (before or in term.h) some header that defines TTY but shouldn't do so. That makes your code compile correctly even though technically it is wrong.
Then you moved to a compiler with a stricter set of headers so nothing is defined unless you include one of the headers that officially should define that thing.
I don't even know which standard contains the official rules on which headers should/shouldn't define TTY, etc. I would guess it is part of POSIX, but I don't really know and I've never had access to a copy to check such things.
Is termios.h included in sc_upiur.c? You need a struct definition for TTY.
edit: It looks like termios.h or termio.h should be included in term.h. On my machine, if struct termio were used instead of struct termios, there would be no definition for struct termio. Can you post your term.h file?
Kevin Barry
I have attached the term.h file.
termios.h is included in term.h and term.h is included in another header file io_util.h, which then is included in sc_upiur.c
yep, I think that you're using some part of the Ntty struct that isn't available on linux, or perhaps your version of ncurses is too old. again, some actual code just before the problematic line would be helpful.
yep, I think that you're using some part of the Ntty struct that isn't available on linux, or perhaps your version of ncurses is too old. again, some actual code just before the problematic line would be helpful.
Here is the code. the error points to the line where i have included io_util.h
124 /*--- Includes ---*/
125 #include "/cisa/src/lib/io_util/io_util.h"
126 #include <pir.h>
127 #include <stdio.h>
128
129 /*-----------------------------------------------------------------------------------------*/
130
131
132 /*--- Defines ---*/
133 #define SOURCE_CSS 0
134 #define SOURCE_MH 1
135 #define SOURCE_GP 2
136 #define SOURCE_TOTALS 3
137 #define SOURCE_NO_SOURCES 4
138
139 #define MAX_PIUR_FILES 30000
140
=================================================================================================
the header: io_util.h doesn't use TTY or NTTY anywhere
i could hv posted tyhe header as well but, its of 868 lines
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.