473,386 Members | 1,736 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,386 software developers and data experts.

syntax error : missing ';' before '<'

in matrixsolvermechanisms.hpp I have the following:

[HTML]template <class V, class I> class LUTridiagonalSolver

{ ...

void calculateBetaGamma();

}[/HTML]
Then in matrixsolvermechanisms.cpp I have the following:

[HTML]template <class V, class I> void LUTridiagonalSolver<V,I>::calculateBetaGamma(){
...}[/HTML]


I am getting the following errors about this:

syntax error : missing ';' before '<'
'LUTridiagonalSolver' : illegal use of type 'void'
unrecognizable template declaration/definition
syntax error : '<'
'calculateBetaGamma' : is not a member of '`global namespace''
Jul 30 '07 #1
6 15374
weaknessforcats
9,208 Expert Mod 8TB
You are missing a semi-colon at the end of your class definition.

I added it and the code compiled.
Jul 30 '07 #2
It seems like this is not the problem because I have ; in the original code. So, I don't understand how it compiles as I am using Visual C++ express as well. Might it be because I have some more code in these templates than the ones I have posted or is it because the definition and the decleration of functions are in seperate files in my code?
Jul 31 '07 #3
JosAH
11,448 Expert 8TB
It seems like this is not the problem because I have ; in the original code. So, I don't understand how it compiles as I am using Visual C++ express as well. Might it be because I have some more code in these templates than the ones I have posted or is it because the definition and the decleration of functions are in seperate files in my code?
Your compiler did not just spit out that error diagnostic text, it also gave you a
file name and a line number. In your case just before that file and line number
(probably in another .hpp or .h file) you have forgotten a trailing semi-colon.

kind regards,

Jos
Jul 31 '07 #4
what you say makes sense. However, I am having difficulty in identifying where that missing ";" is. The exact error message is as follows:

1>main.cpp
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2143: syntax error : missing ';' before '<'
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2182: 'LUTridiagonalSolver' : illegal use of type 'void'
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2988: unrecognizable template declaration/definition
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2059: syntax error : '<'
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2039: 'calculateBetaGamma' : is not a member of '`global namespace''

So do you think the problem is in main.cpp or in matrixsolvermechanisms.cpp?
Jul 31 '07 #5
weaknessforcats
9,208 Expert Mod 8TB
This error:
1>main.cpp
1>c:\users\ek\documents\visual studio 2005\projects\vec\vec\matrixsolvermechanisms.cpp(2 8) : error C2143: syntax error : missing ';' before '<'
says the compiler was compiling main.cpp and on line 28 it encountered an unexpected <. So it suggests you might are missing a ; on line 27, or 26, or 25, etc.

You have to go backwards from the < on line 28 upwards in main.cpp and into the header files you included to see where the error is. It may not be a missing semi-colon. All you know for sure is that the compiler was not expecting a < on line 28.

Fix the first error and recompile. Subsequent errors are often caused by the first error.
Jul 31 '07 #6
OK, I have found it it was before line 28 of matrixsolvermechanisms.cpp.
Aug 1 '07 #7

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

Similar topics

3
by: andrew | last post by:
Ok, pretty new to this php stuff, but good with perl/python etc. What is wrong with this php document ??? I get this error: Parse error: syntax error, unexpected $end in...
8
by: middletree | last post by:
What's wrong with this code? strLongDesc = Replace(Replace(Replace(Replace(Trim(Request.Form("LongDesc")),"'","''"),vbC rLf,"<br>"),"<",&lt;),"<",&gt;) Background: This field is a textarea, and I...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
24
by: deko | last post by:
I'm trying to log error messages and sometimes (no telling when or where) the message contains a string with double quotes. Is there a way get the query to insert the string with the double...
5
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by...
1
by: Phil Powell | last post by:
&lt;input type="submit" name="delete_student" value="Delete Applicant" onClick="setSubmitVal(this); return willDeleteApplicant('O&amp;#039;Connor, Kerry B');"&gt; This HTML tag causes Javascript errors in...
17
by: pbd22 | last post by:
hi. i keep getting this error. as i understand it, my xml isn't formatted correctly. the online errata suggests the standard formatting to solve this problem: element (tab) (tab) element
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
5
Banfa
by: Banfa | last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.