473,659 Members | 2,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: expected unqualified-id before '.' token??

6 New Member
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





Expand|Select|Wrap|Line Numbers
  1. #include <GLUT/glut.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. const GLdouble twoPi =6.283185;
  6.  
  7. class scrPt {
  8. public:
  9.     GLint x, y;
  10. };
  11.  
  12. GLsizei winWidth = 400, winHeight =300;
  13.  
  14. void init (void)
  15. {
  16.     glClearColor (1.0,1.0,1.0,1.0);
  17.  
  18.     glMatrixMode (GL_PROJECTION);
  19.     gluOrtho2D (0.0,200.0,0.0,150.0);
  20. }
  21. . >>>>> the error is here (error: expected unqualified-id before '.' token)
  22. .
  23. .// Midpoint routines for displaying a circle
  24.  
  25. void pieChart (void)
  26. {
  27.     scrPt circCtr, piePt;
  28.     GLint radius = winWidth/4;
  29.  
  30.     GLdouble sliceAngle, previosSliceAngle = 0.0;
  31.  
  32.     GLint k, nSlices = 12;
  33.     GLfloat dataValues[12] = {10.0,7.0,13.0,5.0,13.0,14.0,3.0,16.0,5.0,3.0,17.0,8.0};
  34.     GLfloat dataSum =0.0;
  35.  
  36.     circCtr.x = winWidth/2;
  37.     circCtr.y =winHeight / 2;
  38.     circleMidpoint (circCtr, radius);
  39.  
  40.     for (k =0; k< nSlices; k++)
  41.         dataSum += dataValues[k];
  42.  
  43.     for (k =0; k< nSlices; k++) {
  44.         sliceAngle =twoPi * dataValues[k]/ dataSum + previousSliceAngle;
  45.         piePt.x = circCtr.x + radius *cos (sliceAngle);
  46.         piePt.y = circCtr.y + radius *sin (sliceAngle);
  47.         glBegin (GL_LINES);
  48.         glVertex2i(circCtr.x, circCtr.y);
  49.         glVertex2i(piePt.x, piePt.y);
  50.         glEnd ();
  51.         previousSliceAngle = sliceAngle;
  52.     }
  53. }
  54.  
  55.  
  56. void displayFcn (void)
  57. {
  58.     glClear (GL_COLOR_BUFFER_BIT);
  59.     glColor3f (0.0,0.0,1.0);
  60.     pieChart (); >>>>>>>>>>>>>>>>( error: 'pieChart' was not declared in this scope )
  61.     glFlush ();
  62. }
  63. void winReshapeFcn (GLint newWidth, GLint newHeight)
  64. {
  65.     glMatrixMode (GL_PROJECTION);
  66.     glLoadIdentity ();
  67.     gluOrtho2D (0.0, GLdouble (newWidth), 0.0, GLdouble (newHeight));
  68.  
  69.     glClear (GL_COLOR_BUFFER_BIT);
  70.  
  71.     /* Reset diaply-window size parameters. */
  72.     winWidth = newWidth;
  73.     winHeight = newHeight;
  74.  
  75. }
  76.  
  77. int main (int argc, char** argv)
  78. {
  79.     glutInit (&argc, argv);
  80.     glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
  81.     glutInitWindowPosition (100,100);
  82.     glutInitWindowSize (winWidth,winHeight);
  83.     glutCreateWindow ("Pie Chart");
  84.  
  85.     init();
  86.     glutDisplayFunc (displayFcn);
  87.     glutReshapeFunc (winReshapeFcn);
  88.  
  89.     glutMainLoop ();
  90.  
  91. }
Feb 19 '10 #1
12 18294
newb16
687 Contributor
. >>>>> the error is here (error: expected unqualified-id before '.' token)
.
.//

All these three dots (before '>>>', on the next line , and before '//'), are they in the code? Why are they there?
Feb 19 '10 #2
sam23
6 New Member
yes they are in the code ... its refer to the Midpoint routines for displaying a circle.
Feb 24 '10 #3
donbock
2,426 Recognized Expert Top Contributor
Those periods don't look like legal C syntax. What do you expect them to do?
Feb 24 '10 #4
sam23
6 New Member
Midpoint routines for displaying a circle
Mar 5 '10 #5
Banfa
9,065 Recognized Expert Moderator Expert
Have you tried just removing lines 21,22 and 23 and compiling the code?
Mar 5 '10 #6
sam23
6 New Member
Banfa : yes i tried but its end up with error and when i correct the error my output is a pie chart without a circle :)
Mar 5 '10 #7
donbock
2,426 Recognized Expert Top Contributor
@sam23
Your source code snippet consists of
  • Include some header files (lines 1-3)
  • Define a global variable (line 5)
  • Define class scrPt (line 7)
  • Define two more global variables (line12)
  • Function init (lines 14-20)
  • Three periods and a comment (lines 21-23)
  • Function pieChart (lines 25-53)
  • Function displayFcn (lines 56-62)
  • Function winReshapeFcn (lines 63-75)
  • Function main (lines 77-end)
Why do you so adamantly believe that the compiler interprets three periods as the instructions for inserting midpoint routines for displaying a circle?

Much more likely is that these periods were meant to be interpreted as an ellipsis in whatever source you cut and pasted this code from. That is, they indicate that a block of code (not needed to make the point) was omitted.
Mar 5 '10 #8
donbock
2,426 Recognized Expert Top Contributor
@sam23
At line 38, pieChart calls function circleMidpoint -- passing it the center and radius. You don't have a circleMidpoint function. You will need to write it.
Mar 5 '10 #9
sam23
6 New Member
donbock : i really dont understand :(
My lecturer just gave this coding and ask us to try to run it..
I dont have idea how to write fucntion for this circle Midpoint !
Mar 5 '10 #10

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

Similar topics

4
22112
by: matt hegarty | last post by:
Hi I am relatively new to XML, but am having problems with a validation issue. When the XML is parsed and validated using Xerces, the following error is seen: cvc-complex-type.3.2.2: Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in element 'questionFeed'.
17
27268
by: Ange T | last post by:
Hi there, I'm having pain with the VB behind an Access form. The form is used to create reports in Excel based on the details entered in the form. This has always worked without error on my machine (NT4, Access 2k), however as soon as I attempt to create anything on another machine (NT4, Access 2k) which most users will be working from, I receive an automation error. The problem line with the code is:
3
1922
by: mavis | last post by:
Unqualified element in XSD definition For some reason, we may need to define elements in XSD to be "unqualified". According to the design patterns of XSD, it seems they do not recommend to define elements in this way....it seems it will influence XPATH / XSLT, etc...
4
1649
by: Igor Koretsky | last post by:
Hi. Using VB.Net System.Xml 1.0 SchemaCollection Object I am getting an error when trying to add ‘Schema A’ to the SchemaCollection. Here are my schema files..
9
2332
by: subramanian | last post by:
Hello. Consider the following code fragment : enum TestEnum { val1 = 10, val2 = 100, val3 = 1000 }; class Test { public : enum TestEnum { val1 = 1, val2 val3 }; Test(int i = 0, int j = 0, TestEnum val = TestEnum(0)); ...
9
6471
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified, and the default namespace needs to be included on it as an attribute. The schema I'm using is this: <xs:schema xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"...
0
3046
by: =?Utf-8?B?a3Jpc2huYQ==?= | last post by:
Hi i am getting the following error while using XMLSerializer XmlSerializer ser = new XmlSerializer(typeof(Person)); ERROR: Unable to generate a temporary class (result=1). error CS0266: Cannot implicitly convert type 'XSD.BiodataGender?' to 'XSD.BiodataRace?'. An explicit conversion exists (are you missing a cast?) I am getting the above error when my xsd has multiple nillable elements of userdefined type. If I change the type of...
1
1721
by: mharrison | last post by:
Hi All, I'm using SQL 2000 and in a DTS I want to load in an error XML file to a SQL table. I am using the SQLXMLBulkLoad component in an Active X script. I have an XML file. see below, and also an XSD schema file. Could someone take a look and see where I am going wrong??! I get an error from SQL stating "Relationship expected on errors"
0
1777
by: Stef Mientki | last post by:
hello, I've syntax error which I totally don't understand: ########## mainfile : import test_upframe2 if __name__ == '__main__': var1 = 33 code = 'print var1 + 3 \n'
0
2996
by: Terry Reedy | last post by:
Stef Mientki wrote: Indendation is screwed. Is the above all do_more body? Which locals does this get you? __init__'s? (locals()?) Isn't this just the same as globals()?
0
8427
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
8851
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...
0
8627
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
7356
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
6179
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
5649
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
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2750
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
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.