LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-03-2008, 10:59 AM   #1
samrat_rao
LQ Newbie
 
Registered: Nov 2008
Location: India
Posts: 29

Rep: Reputation: 16
error: initializer element is not constant


Hi,
I am trying to compile an old program (made sometime around 1993). After trial and error i reduced the warnings by including the correct headers (i have gcc 4.3.1). But i am stuck here:
Quote:
lexer.c:40: error: initializer element is not constant
lexer.c:40: error: (near initialization for ‘yyin’)
lexer.c:40: error: initializer element is not constant
lexer.c:40: error: (near initialization for ‘yyout’)
make: *** [lexer.o] Error 1
Line number 40 of lexer.c has:
Quote:
FILE *yyin ={stdin}, *yyout ={stdout};
Both stdin and stdout have no values assigned to them in any file. Could someone advise? There are no fortran files in the package.

I am not a programmer and have rudimentary knowledge of C.

Thanks.
 
Old 12-03-2008, 11:15 AM   #2
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
I very much doubt this is the source of the problem even thought the output seems to point to this location. Is there any error before these as that seems perfectly valid to me.
 
Old 12-03-2008, 11:26 AM   #3
samrat_rao
LQ Newbie
 
Registered: Nov 2008
Location: India
Posts: 29

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dmail View Post
I very much doubt this is the source of the problem even thought the output seems to point to this location. Is there any error before these as that seems perfectly valid to me.
Initially there were warnings and not errors in some other files but after i included some headers in those files, this was the first error that i got. But i found a similar reference in the net and made the following change:
Code:
FILE *yyin,*yyout;
main()
{
   yyin = stdin;
   yyout = stdout;
}
So the compilation went on but now again i am stuck:
Quote:
lexer.o: In function `main':
lexer.c.text+0x0): multiple definition of `main'
mpeg.o:mpeg.c.text+0x5010): first defined here
collect2: ld returned 1 exit status
make: *** [mpeg] Error 1
I thought that this change would be fine since lexer.c does not have any other main in the body.
 
Old 12-03-2008, 11:31 AM   #4
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
It sounds like you are building libraries, have you tried contacting the author of the application? The hit and miss approach with only a little knowledge of C is going be a long and laborious process, one which you may not complete.
What is the application? does it have a website? Has the application been updated/had bug fixes applied?
 
Old 12-03-2008, 12:01 PM   #5
samrat_rao
LQ Newbie
 
Registered: Nov 2008
Location: India
Posts: 29

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by dmail View Post
It sounds like you are building libraries, have you tried contacting the author of the application? The hit and miss approach with only a little knowledge of C is going be a long and laborious process, one which you may not complete.
What is the application? does it have a website? Has the application been updated/had bug fixes applied?
The application is so obscure that only an archived version is available on the net. It dates back to 1994. Its called MPEGv1.1.

I have a software that creates mgm files. To display it as a movie, the software recommends MPEGv1.1.

I tried making this change:
Code:
FILE *yyin, *yyout;
instead of the line:
Code:
FILE *yyin ={stdin}, *yyout ={stdout};
The errors have disappeared and the executable has been made. But could the executable be incorrectly compiled?
 
Old 12-03-2008, 12:32 PM   #6
dmail
Member
 
Registered: Oct 2005
Posts: 970

Rep: Reputation: Disabled
To me that C code is valid and what you have done is just changed to a different way of doing it which really should not matter. The application could be built correctly yet on the other hand it could make your computer catch fire and burn (well it could lol). Just try it and see if it does what it is supposed to do or if it crashes step through it with a debugger, although this would take more knowledge of C.
 
Old 12-03-2008, 01:02 PM   #7
samrat_rao
LQ Newbie
 
Registered: Nov 2008
Location: India
Posts: 29

Original Poster
Rep: Reputation: 16
Thanks for your assurance. I guess someday i'll need to learn to use a debugger. Right now i am having trouble compiling another code !!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
error: variable ‘fops’ has initializer but incomplete type rajkumar_halle Programming 1 08-24-2008 08:57 AM
error: variable ‘scull_fops’ has initializer but incomplete type rajkumar_halle Programming 1 08-19-2008 12:51 AM
error :variable fops has initializer but incomplete type in compile device driver saffari62 Programming 1 04-06-2008 01:53 PM
error: new : cannot specify initializer for arrays powah Programming 2 02-01-2007 04:15 PM

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

All times are GMT -5. The time now is 09:42 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