LinuxQuestions.org
Help answer threads with 0 replies.
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 04-01-2006, 02:10 AM   #1
cynthia_thomas
LQ Newbie
 
Registered: Oct 2005
Posts: 28

Rep: Reputation: 15
two types specified in one empty declaration


hi ,
this is the code lines which produce the error


//Rule Options

struct OptionTreeNode
{
int optionNo;
struct OptionTreeNode *next; //this line creates the error
};

error: two types specified in one empty declaration

please help

thanks and regards
cynthia
 
Old 04-01-2006, 04:31 AM   #2
Hivemind
Member
 
Registered: Sep 2004
Posts: 273

Rep: Reputation: 30
That's a perfectly valid struct declaration. See if you can compile this simple program:

Code:
struct OptionTreeNode
{
int optionNo;
struct OptionTreeNode *next;
};

int
main(void)
{
   struct OptionTreeNode foo;

   (void)foo;

   return 0;
}

It should compile cleanly under gcc, even using the option -W -Wall -ansi -pedantic.
 
Old 04-14-2014, 06:54 AM   #3
cvhelo
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
Smile got same error "two types specified in one empty declaration"

in case anyone searches for this error. My error was no semicolon at end of structure.
 
Old 04-15-2014, 10:43 AM   #4
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170Reputation: 3170
Quote:
Originally Posted by cvhelo View Post
in case anyone searches for this error. My error was no semicolon at end of structure.
Cynthia, could you *just for completeness and "for the record" post a snippet of code which compiles correctly? I don't see (in the OP) "no semicolon at end of structure." Let's make it extremely obvious to whomever next reads this thread exactly what the was.
 
Old 04-16-2014, 06:43 AM   #5
cvhelo
LQ Newbie
 
Registered: May 2009
Posts: 2

Rep: Reputation: 0
Smile snippet of code that caused compile error

Here is the code that caused the error:

struct det_info_type /*PCR01409*/
/*----------------------
* DESCRIPTION: The detection structure type for this message.
* UNITS : None
* LSB : N/A
*/
{
unsigned cdi_id:16; /*PCR01409*/
/*----------------------
* DESCRIPTION: The Cdi where the detection occurred.
* UNITS : None
* LSB : N/A
*/
unsigned spare:8; /*PCR01409*/
/*----------------------
* DESCRIPTION: A spare field
* UNITS : None
* LSB : N/A
*/
unsigned hrrId:7; /*PCR01409*/
/*-------------------------
* DESCRIPTION : HRR detection ID
* Valid iff detSrc = 1 or 3
* UNITS : N/A
* LSB : 1
*/
unsigned valid:1; /*PCR01409*/
/*----------------------
* DESCRIPTION: A bit indicating if the detection is valid
* UNITS : None
* LSB : N/A
*/
} /*PCR01409*/

I had to add a semicolon after the last bracket to make it compile.
 
  


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
C Global Declaration Aju Programming 3 09-29-2005 05:21 AM
char * declaration in c; alaios Programming 19 09-14-2005 10:50 PM
the c declaration kapsikum Programming 3 04-06-2005 03:12 AM
Gentoo VNC, empty dialog box !! "Question" window is empty ! TheHushedCaskeT Linux - Software 0 02-01-2005 11:14 PM
How to understand the declaration? Xiangbuilder Programming 8 09-13-2003 05:49 AM

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

All times are GMT -5. The time now is 12:04 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration