473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

6
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 18225
newb16
687 512MB
. >>>>> 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
yes they are in the code ... its refer to the Midpoint routines for displaying a circle.
Feb 24 '10 #3
donbock
2,426 Expert 2GB
Those periods don't look like legal C syntax. What do you expect them to do?
Feb 24 '10 #4
sam23
6
Midpoint routines for displaying a circle
Mar 5 '10 #5
Banfa
9,065 Expert Mod 8TB
Have you tried just removing lines 21,22 and 23 and compiling the code?
Mar 5 '10 #6
sam23
6
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 Expert 2GB
@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 Expert 2GB
@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
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
jkmyoung
2,057 Expert 2GB
I would consult with your lecturer or teaching assistant as to how to write the midpoint function to complete the code. Perhaps this is the conclusion you are supposed to reach.
Mar 5 '10 #11
when you get the code from anybody, better walik through the code, what code is going to do with your system ?. It will help for development/debug knowledge.
Mar 8 '10 #12
sam23
6
Sure sri :)
Nandri :)
Mar 14 '10 #13

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

Similar topics

4
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:...
17
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...
3
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 ...
4
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
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,...
9
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,...
0
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...
1
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...
0
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
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.