compiling error - help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2005
Posts: 3
Reputation: ecua_frap is an unknown quantity at this point 
Solved Threads: 0
ecua_frap ecua_frap is offline Offline
Newbie Poster

compiling error - help

 
0
  #1
Apr 11th, 2005
hi.. i'm pretty new with C++, so pls. bear with my question, simple as it may be.

can anyone pls. tell me what this error mean:
syntax error before `<'

i have a whole bunch of them when i try to compile.. if needed, i'll post up the codes.

Thanks!
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,612
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: compiling error - help

 
0
  #2
Apr 11th, 2005
Most likely you're trying to use a standard template class without including the header. Post the code.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 3
Reputation: ecua_frap is an unknown quantity at this point 
Solved Threads: 0
ecua_frap ecua_frap is offline Offline
Newbie Poster

Re: compiling error - help

 
0
  #3
Apr 11th, 2005
here is my code..

  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. const double APR = .1999;
  6. const double financeCharge = .0167;
  7. const int lateFee = 20
  8.  
  9.  
  10. int main ()
  11. {
  12. double amountPastDue;
  13. double amountExcessCredit;
  14. int RevCreditLine;
  15. double PercentOver;
  16. double minAmount1;
  17.  
  18. cout << "Enter customer's amount Past Due = $";
  19. cin >> amountPastDue;
  20. cout << "Enter amount in excess of revolving credit line (if none, enter
  21. 0) = $";
  22. cin >> amountExcessCredit;
  23. cout << endl;
  24.  
  25. {
  26. minAmount1 = amountPastDue + amountExcessCredit;
  27. cout << "$" << minAmount1 << endl;
  28. }
  29. cout << endl;
  30.  
  31. double TotalPercOver;
  32. double minAmount2;
  33.  
  34. cout << "Enter customer's revolving credit line = $";
  35. cin >> RevCreditLine;
  36.  
  37. {
  38. PercentOver = (amountExcessCredit / RevCreditLine);
  39. cout << PercentOver*100 << "%" << endl;
  40. }
  41. {
  42. TotalPercOver = APR + PercentOver;
  43. cout << TotalPercOver*100 << "%" << endl;
  44. }
  45. if (TotalPercOver > .1999)
  46. {
  47. minAmount2 = 5 + (minAmount1);
  48. cout << "$" << minAmount2 << endl;
  49. }
  50. else
  51. {
  52. minAmount2 = minAmount1;
  53. cout << "$" << minAmount2 << endl;
  54. }
  55.  
  56. cout << endl;
  57.  
  58. char largestAmount;
  59. double totalA;
  60. double newBalance;
  61. double totalB;
  62. int totalC;
  63. double totalMinAmount;
  64.  
  65. cout << "Enter customer's new balance = ";
  66. cin >> newBalance;
  67. cout << "$" << newBalance << endl;
  68.  
  69. switch (largestAmount) {
  70. case A: {
  71. totalA = (financeCharge*amountPastDue) + lateFee;
  72. cout << "$" << totalA << endl;
  73. break;
  74. }
  75. case B: {
  76. if (newBalance < 20) {
  77. totalB = newBalance;
  78. cout << "$" << totalB << endl;
  79. }
  80. break;
  81. }
  82. case C: {
  83. if (newBalance >= 20, newBalance <= 960) {
  84. totalC = 20;
  85. cout << "$" << totalC << endl;
  86. }
  87. break;
  88. }
  89. case D: {
  90. if (newBalance < 960) {
  91. totalD = ((1/48)*newBalance);
  92. cout << "$" << totalD << endl;
  93. }
  94. break;
  95. }
  96. }
  97.  
  98. cout << "Of the four codes, enter one which generated the largest amount
  99. : ";
  100. cin >> largestAmount;
  101. cout << endl;
  102.  
  103. {
  104. totalMinAmount = minAmount1 + minAmount2 + largestAmount;
  105. cout << "$" << totalMinAmount << endl;
  106. }
  107. return 0;
  108.  
  109. }
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,612
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: compiling error - help

 
0
  #4
Apr 11th, 2005
There's really too much wrong with that code to fix. I suggest you start over, this time compiling and testing as you go. As it is, it looks like you wrote it all before ever trying to compile.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 3
Reputation: ecua_frap is an unknown quantity at this point 
Solved Threads: 0
ecua_frap ecua_frap is offline Offline
Newbie Poster

Re: compiling error - help

 
0
  #5
Apr 11th, 2005
i did that for the first half and it was working fine.. however, due to time constraint, i wrote the second half without checking it. then when i tried to compile it all, it didn't work anymore. stupid mistake - now i'm faced with a problem

but as i asked initially, in general, what does the error " syntax error before `<' " mean?

if it helps, these are the errors i get:
  1. assign1.cpp:10: parse error before `int'
  2. assign1.cpp:18: syntax error before `<'
  3. assign1.cpp:19: syntax error before `>'
  4. assign1.cpp:20: syntax error before `<'
  5. assign1.cpp:21: syntax error before `>'
  6. assign1.cpp:22: syntax error before `<'
  7. assign1.cpp:26: syntax error before `<'
  8. assign1.cpp:28: syntax error before `<'
  9. assign1.cpp:33: syntax error before `<'
  10. assign1.cpp:34: syntax error before `>'
  11. assign1.cpp:38: syntax error before `<'
  12. assign1.cpp:42: syntax error before `<'
  13. assign1.cpp:47: syntax error before `<'
  14. assign1.cpp:52: syntax error before `<'
  15. assign1.cpp:55: syntax error before `<'
  16. assign1.cpp:64: syntax error before `<'
  17. assign1.cpp:65: syntax error before `>'
  18. assign1.cpp:66: syntax error before `<'
  19. assign1.cpp:71: syntax error before `<'
  20. assign1.cpp:77: syntax error before `<'
  21. assign1.cpp:84: syntax error before `<'
  22. assign1.cpp:91: syntax error before `<'
  23. assign1.cpp:97: syntax error before `<'
  24. assign1.cpp:98: syntax error before `>'
  25. assign1.cpp:99: syntax error before `<'
  26. assign1.cpp:103: syntax error before `<'

if my problem is really impossible to solve, then i'll re-do everything over.. thanks for taking your time to help anyway..
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 63
Reputation: marinme is an unknown quantity at this point 
Solved Threads: 1
marinme marinme is offline Offline
Junior Poster in Training

Re: compiling error - help

 
0
  #6
Apr 12th, 2005
Originally Posted by ecua_frap
but as i asked initially, in general, what does the error " syntax error before `<' " mean?
well, in general, it means something used before the '<' symbol was sytactically incorrect(used incorrectly).
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,612
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 713
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: compiling error - help

 
0
  #7
Apr 12th, 2005
>what does the error " syntax error before `<' " mean?
You have syntax errors all over the place, but the first error is failure to terminate this line with a semicolon:
  1. const int lateFee = 20
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Mar 2004
Posts: 1,620
Reputation: kc0arf is a jewel in the rough kc0arf is a jewel in the rough kc0arf is a jewel in the rough 
Solved Threads: 51
Team Colleague
kc0arf kc0arf is offline Offline
Posting Virtuoso

Re: compiling error - help

 
0
  #8
Apr 12th, 2005
Hi,

Just to point out, those numbers in the syntax error report are line numbers inside the files. Look a few lines up or down of the cited line number for a hint.

For example,

  1. 1.... #include <iostream>
  2. 2.... #include <iomanip>
  3. 3.....using namespace std;
  4. 4.....
  5. 5.....const double APR = .1999;
  6. 6.....const double financeCharge = .0167;
  7. 7.....const int lateFee = 20
  8. 8.....
  9. 9.....
  10. 10....int main ()
  11. 11....{
  12. 12....
  13.  
  14. assign1.cpp:10: parse error before `int'
  15.  

We see that there is a problem somewhere around line 10. Looking up a few lines, we see the statement lateFee = 20 but no semicolon (

The numbers are there to help you. It has been my experience that the numbers hint to problems above the line number. Also remember that one little bug can throw the whole soup down the drain... fix from top to bottom, and you can see from time to time that a whole mess of things get corrected by fixing one little part.

This is the art of debugging.

Christian
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC