By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,404 Members | 1,037 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,404 IT Pros & Developers. It's quick & easy.

template and friend problem

P: n/a
Hi,

I have some problems with fried declarations in a template class.
The class looks like:

namespace iltVector3
{

template<class T> class Matrix3
{
private:
T m_Mat[3][3];
int m_N;
public:
..
..
..

friend Matrix3<T> operator*(T a, Matrix3<T> & A);
};
}

When compiling with MSVC++6 I get an error message. The error message is
in German, so I try to translate:
f:\pr1\rt3d\src\cpp\ilt_vector3.h(197) : error C2143: Syntax error :
missing ';' ahead of '<'
f:\pr1\rt3d\src\cpp\ilt_vector3.h(199) : See reference to
instantiation of the precompiled class template 'iltVector3::Matrix3<T>'

Line 197 is exactly the line of the friend declaration.

Is my friend declaration wrong? Is it a bug (feature?) of VC++6?
I would be very appreciative for any help.

Regards

Rolf Wester

Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rolf Wester wrote:
When compiling with MSVC++6 I get an error message. The error message is
in German, so I try to translate:

f:\pr1\rt3d\src\cpp\ilt_vector3.h(197) : error C2143: Syntax error :
missing ';' ahead of '<'
f:\pr1\rt3d\src\cpp\ilt_vector3.h(199) : See reference to
instantiation of the precompiled class template 'iltVector3::Matrix3<T>'

Line 197 is exactly the line of the friend declaration.

Is my friend declaration wrong? Is it a bug (feature?) of VC++6?
I would be very appreciative for any help.


Your code is ok and the snipped compiles fine with VC6. Please post a
minimal example that shows your problem.

Christoph

Jul 19 '05 #2

P: n/a

"Christoph Rabel" <od**@hal9000.vc-graz.ac.at> wrote in message
news:3f********@e-post.inode.at...
Rolf Wester wrote:
> When compiling with MSVC++6 I get an error message. The error message is in German, so I try to translate:

f:\pr1\rt3d\src\cpp\ilt_vector3.h(197) : error C2143: Syntax error :
missing ';' ahead of '<'
f:\pr1\rt3d\src\cpp\ilt_vector3.h(199) : See reference to
instantiation of the precompiled class template 'iltVector3::Matrix3<T>'

Line 197 is exactly the line of the friend declaration.

Is my friend declaration wrong? Is it a bug (feature?) of VC++6?
I would be very appreciative for any help.


Your code is ok and the snipped compiles fine with VC6. Please post a
minimal example that shows your problem.

Christoph


Could be a service pack issue, the OP should make sure they have the latest
service pack (service pack 5 I think).

john
Jul 19 '05 #3

P: n/a
Christoph Rabel wrote:

Your code is ok and the snipped compiles fine with VC6. Please post a
minimal example that shows your problem.

Christoph

Christoph and Jogn thanks a lot for your replies. I don't know what is
different since when I got the posted error message but now it works
fine for me too. Sorry for the inconvenience.

Regards

Rolf Wester

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.