LinuxQuestions.org
Register a domain and help support LQ
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 11-18-2009, 12:47 AM   #1
biplabbijay
Member
 
Registered: Jul 2009
Posts: 81

Rep: Reputation: 15
ERROR MESSAGE: ' Expected class name before ',' token.


HI, I AM USING SUSE LINUX VERSION 11.0.THE GCC VERSION IS " gcc version 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036] (SUSE Linux)".I AM NEW IN C++ PROGRAMMING.I GOT A SOURCE CODE, Spectr_ts.c, WHERE A CLASS IS DEFINED IN THE FOLLOWING WAY:

60 class Chamber : public sh_manip_absvol , public box , public EnTransfCSType , public HeedDeltaElectronCSType , public SensitiveVolume;
61 {
62 public:
63 virtual absvol* Gavol(void) const {return (box*) this; };
64 protected:
65 virtual void get_components(ActivePtr<absref_transmit>& aref_tran)
66 {
67 sh_manip_absvol::get_components(aref_tran);
68 }
69 public:
70 //virtual DynLinArr< manip_absvol * > Gamanip_embed(void) const ;
71 Chamber(void) {;}
72 Chamber(const abssyscoor& fcsys,
73 const EnTransfCSType etcst,
74 const HeedDeltaElectronCSType hdecst);
75
76 macro_copy_total(Chamber);
77 //virtual absvol* copy(void) const ;
78 virtual void print(ostream& file, int l) const ;
79
80};

WHEN I TRIED TO COMPILE IT I GOT THE ERROR MESSAGE:

Spectr_ts.c:60: error: expected class-name before ‘,’ token
Spectr_ts.c:60: error: expected `{' before ‘;’ token
Spectr_ts.c:61: error: expected unqualified-id before ‘{’ token

I HAVE NO IDEA ABOUT THIS.CAN ANY BODY SUGGEST ME SOME SOLUTION FOR THIS PROBLEM ? THANKS IN ADVANCE.
 
Old 11-18-2009, 03:39 AM   #2
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 54
Please don't post in capitals, and put code inside [code] tags.

The first thing I notice is the semicolon ( ; ) at the end of SensitiveVolume (line 60). Take that out and it should fix errors 2 and 3. Do the classes you're inheriting from exist? That might be the cause for the first error.

Last edited by Komakino; 11-18-2009 at 03:41 AM.
 
Old 11-18-2009, 05:07 AM   #3
biplabbijay
Member
 
Registered: Jul 2009
Posts: 81

Original Poster
Rep: Reputation: 15
thanks to you.I have already removed error 2 and 3 by deleting the semicolon.But the first problem is still there.the error messages are now:

Spectr_ts.c: At global scope:
Spectr_ts.c:60: error: expected class-name before ‘,’ token
Spectr_ts.c:73: error: expected ‘,’ or ‘...’ before ‘etcst’
Spectr_ts.c:74: error: ISO C++ forbids declaration of ‘EnTransfCSType’ with no type
Spectr_ts.c:82: error: expected ‘,’ or ‘...’ before ‘&’ token
Spectr_ts.c:83: error: ISO C++ forbids declaration of ‘EnTransfCSType’ with no type
Spectr_ts.c: In constructor ‘Chamber::Chamber(const abssyscoor&, int)’:
Spectr_ts.c:86: error: class ‘Chamber’ does not have any field named ‘EnTransfCSType’
Spectr_ts.c:86: error: ‘etcst’ was not declared in this scope
Spectr_ts.c:87: error: ‘hdecst’ was not declared in this scope
Spectr_ts.c: In function ‘int main()’:
Spectr_ts.c:173: error: ‘EnTransfCS’ was not declared in this scope
Spectr_ts.c:173: error: expected `;' before ‘etcs’
Spectr_ts.c:198: error: ‘etcs’ was not declared in this scope
Spectr_ts.c:352: error: ‘rnorm’ was not declared in this scope


I could understand your second point (as i dont know much of the programming or don't have any proffessional course):"Do the classes you're inheriting from exist?"
can u please explain me this in detail ?
 
Old 11-18-2009, 06:26 AM   #4
biplabbijay
Member
 
Registered: Jul 2009
Posts: 81

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by biplabbijay View Post
thanks to you.I have already removed error 2 and 3 by deleting the semicolon.But the first problem is still there.the error messages are now:

Spectr_ts.c: At global scope:
Spectr_ts.c:60: error: expected class-name before ‘,’ token
Spectr_ts.c:73: error: expected ‘,’ or ‘...’ before ‘etcst’
Spectr_ts.c:74: error: ISO C++ forbids declaration of ‘EnTransfCSType’ with no type
Spectr_ts.c:82: error: expected ‘,’ or ‘...’ before ‘&’ token
Spectr_ts.c:83: error: ISO C++ forbids declaration of ‘EnTransfCSType’ with no type
Spectr_ts.c: In constructor ‘Chamber::Chamber(const abssyscoor&, int)’:
Spectr_ts.c:86: error: class ‘Chamber’ does not have any field named ‘EnTransfCSType’
Spectr_ts.c:86: error: ‘etcst’ was not declared in this scope
Spectr_ts.c:87: error: ‘hdecst’ was not declared in this scope
Spectr_ts.c: In function ‘int main()’:
Spectr_ts.c:173: error: ‘EnTransfCS’ was not declared in this scope
Spectr_ts.c:173: error: expected `;' before ‘etcs’
Spectr_ts.c:198: error: ‘etcs’ was not declared in this scope
Spectr_ts.c:352: error: ‘rnorm’ was not declared in this scope


I could understand your second point (as i dont know much of the programming or don't have any proffessional course):"Do the classes you're inheriting from exist?"
can u please explain me this in detail ?
Those classes exists.
 
Old 11-18-2009, 06:53 AM   #5
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 54
Hmmm, ok... does the program know those classes exist? i.e. have you #included the necessary header files?
 
Old 11-18-2009, 11:11 PM   #6
biplabbijay
Member
 
Registered: Jul 2009
Posts: 81

Original Poster
Rep: Reputation: 15
error

Quote:
Originally Posted by Komakino View Post
Hmmm, ok... does the program know those classes exist? i.e. have you #included the necessary header files?
sorry i answer late because of internet problem.
yes i have included those classes.
 
Old 11-18-2009, 11:26 PM   #7
biplabbijay
Member
 
Registered: Jul 2009
Posts: 81

Original Poster
Rep: Reputation: 15
solved

Quote:
Originally Posted by biplabbijay View Post
sorry i answer late because of internet problem.
yes i have included those classes.
yes you are right.i must be blind. i forgot to include "EnTransfCSType" in my programme.Thank you verymuch for your help.Thank you.
 
  


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 12:18 PM
expected unqualified-id before { token in C knobby67 Programming 3 04-25-2009 05:11 AM
C compiling error: expected expression before { token CoderMan Programming 3 03-31-2009 05:31 PM
compile error: expected ; before * token osc~ Linux - Software 2 12-05-2008 09:52 AM
Error loading class message generated by applet BobBuchanan Programming 0 06-27-2004 05:39 PM


All times are GMT -5. The time now is 06:03 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration