LinuxQuestions.org
Visit Jeremy's Blog.
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-24-2009, 09:11 AM   #1
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Rep: Reputation: 43
expected unqualified-id before ‘{’ token in C


Hi all,
I've just updated from Debian Etch to Lenny, which in turn updates GCC to 4.3 (?). This has cause a host of error, most of which I can solve however I'm getting the above error in code which has worked for years. The code is related to arrays of structures. Basically I have

typedef struct array_type=
{
int a;
int b;
int c;

}ARRAY_TYPE;

then

ARRAY_TYPE ARAYUSED[]=
{
{0,0,0},
{0,0,0},
{0,0,0},
};

(the real code is to do with loading sprites but the above is a basic idea of what I normally do)

Can anyone advise? Thanks
 
Old 04-24-2009, 09:51 AM   #2
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Sorry fixed it, I'd accidentally posed in a };
 
Old 04-24-2009, 09:51 AM   #3
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081
Code:
typedef struct array_type=
The equal sign shouldn't be there (typo?), after removing that, it compiles for me:

Code:
~/tmp$ cat a.c
typedef struct array_type {
    int a;
    int b;
    int c;
} ARRAY_TYPE;

ARRAY_TYPE ARAYUSED[] = {
    {0,0,0},
    {0,0,0},
    {0,0,0},
};
~/tmp$ gcc -c -Wall -ansi -pedantic a.c
~/tmp$ gcc --version
gcc (Debian 4.3.3-3) 4.3.3
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
 
Old 04-25-2009, 04:11 AM   #4
knobby67
Member
 
Registered: Mar 2006
Posts: 627

Original Poster
Rep: Reputation: 43
Yes thanks a typo. As was my original error. I spend hours updating code from gcc 3.7 to 4.3 :s
 
  


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
compile error: expected ‘;’ before ‘*’ token osc~ Linux - Software 12 12-10-2009 11:18 AM
C compiling error: expected expression before ‘{’ token CoderMan Programming 3 03-31-2009 04:31 PM
compile error: expected ‘;’ before ‘*’ token osc~ Linux - Software 2 12-05-2008 08:52 AM
c++: "expected unqualified-id" newbie errors kpachopoulos Programming 1 08-26-2007 04:16 AM
expected unqualified id Shwetha GS Linux - Software 0 10-21-2005 09:42 AM

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

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