473,666 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to fix "expected identifier or '(' before '{' token" errors?

3 New Member
When trying to compile I get this

/main.c:30: error: expected identifier or '(' before '{' token
../main.c:31: error: expected identifier or '(' before 'if'
make: *** [main.o] Error 1

Expand|Select|Wrap|Line Numbers
  1. SDL_SysWMinfo info;
  2. SDL_VERSION(&info.version);
  3. if ( SDL_GetWMInfo(&info) ) {
  4.   Display *dpy = info.info.x11.display;
  5.   Window win;
  6.  
These are the lines, line 30 and 31 are the second SDL one and the if (... one.

I tried changing anythign around there, but it doesn`t
seem to work. Any ideas?

Thanks!
Feb 25 '11 #1
5 26265
Jason Mortmer
23 New Member
You have to put a closing brace '}' at the end of the function.
Feb 25 '11 #2
donbock
2,426 Recognized Expert Top Contributor
SDL_VERSION is a macro that, in your case, will expand to something like this:
Expand|Select|Wrap|Line Numbers
  1. {
  2.     (&info.version)->major = SDL_MAJOR_VERSION;
  3.     (&info.version)->minor = SDL_MINOR_VERSION;
  4.     (&info.version)->patch = SDL_PATCHLEVEL;
  5. }
I think both of the warnings are complaining about the curly braces generated by the macro. I don't see anything wrong here. Perhaps your version of the macro expands to something slightly different than this.

Try the following as an experiment: change line 2 from
Expand|Select|Wrap|Line Numbers
  1. SDL_VERSION(&info.version); 
to
Expand|Select|Wrap|Line Numbers
  1. do SDL_VERSION(&info.version) while(0);
My suggestion is a travesty -- please don't leave it like that even if the warnings go away.

Which compiler are you using?
Feb 27 '11 #3
Phacer
3 New Member
Well, somehow the error seems to have gone, and
I don`t know why.
I think it`s crazy, but restarting the pc made it go...?
Anyway, now I get a new error..

Expand|Select|Wrap|Line Numbers
  1. cc1plus: warning: command line option "-std=c99" is valid for C/ObjC but not for C++
  2. In file included from ../main.c:20:
  3. ../common.h:105:19: error: SDL.h: No such file or directory
  4. In file included from ../common.h:245
even tough I don't have c++ files, nor mentions on
makefile or any of the project files...
Feb 28 '11 #4
donbock
2,426 Recognized Expert Top Contributor
The errors aren't gone -- this new problem is masking the old one.

What compiler are you using?
How are you invoking it?
Feb 28 '11 #5
Phacer
3 New Member
In fact, I was making a silly mistake on my
c sufixes on my makefile =)
Thanks for everyone`s help!
Mar 2 '11 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
5224
by: Grzegorz Dostatni | last post by:
Good morning. I've got a Tkinter problem: File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 2310, in selection_present return self.tk.getboolean( TclError: expected boolean value but got "" Now a few weeks ago there was a similar problem with the boolean value. That's when the tcl started returning "???" for unknown fields in a
10
7601
by: Ian Lazarus | last post by:
Hello. How do "unresolved token" link errors occur. How do I fix them? Linking... LINK : error LNK2020: unresolved token (0A000015) ??_7type_info@@6B@ LINK : error LNK2020: unresolved token (0A000016) _CxxThrowException LINK : error LNK2020: unresolved token (0A000018) exception.__ctor LINK : error LNK2020: unresolved token (0A000019) exception.__ctor LINK : error LNK2020: unresolved token (0A00001A) exception.__dtor LINK : error...
8
2731
by: trappedIntoCode | last post by:
Hi Everyone, Here is a part of javascript code that works well in FF2 but shows above error in IE6 and error "missing name after . operator" . function PopUp(idf,stepX,stepY,speed){ this.idf=idf; this.popXStep=stepX; this.popYStep=stepY; this.popSpeed=speed; this.popLeft=0;
7
92081
by: Warrax | last post by:
I am currently doing online tutorials for C++, and am pretty much stuck in a rut about this problem. It is saying that there's an expected unqualifed-id before '{' token (I will post the code in just a second) on line 11, and an expected ',' or ';' before '{' token also on line 11, however I don't have a clue what the first one means. The program is meant to save a user's name in a string variable within a structure, and to then show that name...
1
3270
by: nagaraj | last post by:
In Dev C++, we tried to compile a application, but it will throw some peculiar error. please find it below "path/main.cpp expected `]' before ';' token" and the source code is "DWORD rtec_Stack __attribute__((aligned(4)));" is this problem of envirnment or else?
9
11183
by: Rohit | last post by:
I am trying to initialize an array whose initializers depend on value of Enums. I take enum and then decide the initializer value, so that even if enum value changes because of addition to list even then I should be able to get correct value for the array element. I need value and state to be present in a single byte thats why I use macros. Here is what my code look like: typedef enum
1
3669
by: mikr | last post by:
I'm new to jquery, and hoping it will make my client side coding more friendly (particularly with regards to ie). As is usually the case, I've got some code that works nicely in ff, but kicks out an "Expected Identifier" error. So, I've got two questions: What exactly does that mean? What is an "Identifier," particularly within the context of Internet Explorer and JScript? Why am I getting it? The code that is producing the error is...
2
11920
by: Bryan Vargas | last post by:
I keep getting the same "expected indented block" when ever I run my code. from myro import* init("simulator") def main(): for x in range(10): #repeats code in loop 10 times
1
10900
by: Amjad Raza Gill | last post by:
I am facing this problem during the migration from oracle to db2, pls. help to remove this error. I am new to DB2. DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "" was found following "". Expected tokens may include: "". LINE NUMBER=27. SQLSTATE=42601 CONNECT TO MIGT USER db2inst USING db2inst;...
0
8784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2774
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.