LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-11-2011, 12:31 AM   #1
pallavibhat89
LQ Newbie
 
Registered: Dec 2010
Posts: 10

Rep: Reputation: 0
C program compilation errors


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

================================================== ======

the contents of term.h

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;

any suggessions on this are most welcome.

Many thanks in advance
 
Old 02-11-2011, 04:23 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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

Last edited by ta0kira; 02-11-2011 at 04:30 PM.
 
Old 02-11-2011, 04:53 PM   #3
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
I think Kevin is giving you good suggestions for fixing the problem.

Quote:
Originally Posted by pallavibhat89 View Post
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.

Last edited by johnsfine; 02-11-2011 at 04:57 PM.
 
Old 02-14-2011, 12:13 AM   #4
pallavibhat89
LQ Newbie
 
Registered: Dec 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ta0kira View Post
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

term.h has a struct definition for TTY.
Attached Files
File Type: txt term_header.txt (38.1 KB, 20 views)
 
Old 02-15-2011, 02:19 AM   #5
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
Could you provide some code before 125 in sc_upiur.c?
 
Old 02-15-2011, 05:48 PM   #6
DJ Shaji
Member
 
Registered: Dec 2004
Location: Yo Momma's house
Distribution: Fedora Rawhide, ArchLinux
Posts: 518
Blog Entries: 15

Rep: Reputation: 106Reputation: 106
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.
 
Old 02-15-2011, 11:56 PM   #7
pallavibhat89
LQ Newbie
 
Registered: Dec 2010
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by DJ Shaji View Post
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
 
Old 02-16-2011, 12:32 AM   #8
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
It's a long shot ... but it's still worth asking:

Q: "/cisa/include" is an "unusual" location. Are you using "-I" to point to it (and, perhaps, to also OVERRIDE default headers in default locations)?

EXAMPLE:
Code:
gcc -I/cisa/include -o foo foo.c
Just a thought...
 
  


Reply

Tags
ncurses, [c]



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Compilation errors with compiling a program with boost libraries 1.39 Metal_Koola Programming 5 12-04-2009 07:13 PM
Qt Compilation Errors grsandeep85 Linux - Newbie 3 05-10-2009 03:07 AM
compilation errors in g++ manikan Linux - Software 1 02-03-2006 05:31 AM
C++ compilation errors ??? glevine Programming 1 07-16-2004 03:15 PM
Compilation Errors ! vipinsharma Programming 0 06-01-2004 02:24 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration