473,657 Members | 2,378 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: expected identifier or â(â before â{â token ??

1 New Member
I am using a program called putty to write basic programs in C/ C++ for an introduction to computer programming class. I am very new at programming and am just getting started writing very simple programs. When I try to compile my programs, I receive an error message saying

error: expected identifier or â(â before â{â token

and am directed to the line in the program where the program actually starts, the beginning bracket {
this is the only character on the line, and I have received this error message trying to compile multiple programs all at the the same line where the left bracket is placed after int main is established. Any ideas on how I could fix this problem and make my programs able to compile would be fantastic, thank you
Feb 10 '10 #1
1 20226
donbock
2,426 Recognized Expert Top Contributor
Look at the lines preceding the definition of your main function.
  • Are any of them missing the terminating semicolon?
  • Are parentheses and braces balanced?
  • Ask the same questions of any header files that are included prior to the definition of main.

Look at the definition of your main function.
  • Did you balance the parentheses that enclose the parameter list?
  • There should not be a semicolon between the parenthesis that closes the parameter list and the brace that starts the body of the function.

By the way, you do not want to provide a prototype for the main function.
Feb 10 '10 #2

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

Similar topics

4
22246
by: sanctus | last post by:
Is there a typical mistake which generates the error: " error: expected primary-expression before ‘)’ token" because I fail to see why I get this problem and the code is too big to post it here. Also just saying that it depends on the case would be very helpful so I kinow it something specific about the changes I made...
21
35512
by: Ram Prasad | last post by:
I am trying to write a simple libspf2 plugin code for my postfix ( milter) I am getting this unhelpful error message when I try to compile gcc -g1 -Wall -I/usr/local/include/spf2 -I. -c mfunc.c In file included from mfunc.c:1: mfunc.c:42: error: expected ')' before '*' token make: *** Error 1 my mfunc.c has on the line 42
5
15327
by: gyre | last post by:
Hi! I've got a little problem I've been dealing with for several days :(( Code is written in Qt. I'll try to explain it: I created an abstract class "VcaNode" with 4 virtual methods and 3 other members...it is in special header: //ABSTRACT CLASS MEMBER: #ifndef _VCA_NODE #define _VCA_NODE
5
7971
by: amitmool | last post by:
hi, i have used the queue library file and try to use the template as template <class QueueItem> queue <QueueItem>::~queue() // line 25 { } template <class QueueItem> void queue<QueueItem>::push(const QueueItem& entry) // line 42
5
45056
by: nina01 | last post by:
Hi! I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c lex.yy.c ", I keep having this error :-( In file included from comp.l:4: comp.tab.h:56: error: expected identifier before ‘(’ token It's supposed to be a syntax error but I honestly don't know where does it come from knowing that the file...
10
31986
by: anju1401 | last post by:
Hi I am using WINAVR compiler for ATMEGA32. While compiling c progam , I am getting the error error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before '{' token before evrey function. code: #include <avr\io.h>
12
18294
by: sam23 | last post by:
Hi all, im new to this programming language and i tried to use my Xcode to build and run this code but i got a error :(, and another error is i need a help guys #include <GLUT/glut.h> #include <stdlib.h> #include <math.h>
1
3668
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...
5
26263
by: Phacer | last post by:
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: *** Error 1 SDL_SysWMinfo info; SDL_VERSION(&info.version); if ( SDL_GetWMInfo(&info) ) { Display *dpy = info.info.x11.display;
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8504
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7337
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...
0
5632
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();...
1
2732
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
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1622
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.