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

template and friend problem

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
3 1376
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

"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Christophe Barbe | last post by:
I posted a few days ago about the same problem but was not very clear. So here is my second take at it. Basically with GCC 3.3.2, I can't compile the example from the C++ FAQ Lite available...
6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
6
by: Adam Parkin | last post by:
Hello, all I'm having a problem with friend functions in a templatized Queue class I'm writing using linked lists. The problem is that I can't get the friend function to be able to access private...
2
by: Ruben Campos | last post by:
I have a problem with a template function that is declared as a friend of a template class. I'll first show the exact problem with source code: // MyClass.hpp template <typename T> class...
4
by: Justin Miller | last post by:
Ok, I tried to make that subject as descriptive as possible. What I'm trying to do: I'm attempting to use policies to create a generic memento (design pattern) template. My Memento template so...
3
by: CoolPint | last post by:
After upgrading to gcc 3.4.2 from gcc 3.2.3, I got compiler errors that I could not figure out. After reading other postings, I learned that my coding was not compliant to the standard in the first...
2
by: coolpint | last post by:
Can anyone kindly provide an explanation as to why the compiler does not "see" the function template in the contrieved code below? I think the argument deduction fails but can't figure out...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
4
by: Alan Woodland | last post by:
I've been trying out more template metaprogramming ideas with typelists (mostly for personal learning, I'm aware boost most probably provides this facility already), and I've run into this small...
9
by: wo3kie | last post by:
#include <iostream> #include <map> #include <utility> // // Base // / | \ // Derived1 Derived2 \ // \ | / // Derived3
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:
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:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.