Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

template functions

Status
Not open for further replies.

amie8202

Programmer
Joined
Aug 16, 2004
Messages
4
Location
US
Hi,
I'm pretty much new to using VC++ environment..And I really need some help.
I use vc++ 6.0, and I get some errors when I try to compile header file in vc++ which worked in linux.
What I get is a syntax error in the function.. such as

template <Class S, int D>
template <Class X> <- here
Vec<S, D> scale(const X &a)
{
//implementation
}
Is there a way I would not get the error in VC++ for that line, but works same as that?

Thanks in advance!
 
My understanding is that VC++ 6.0 does not support template specializations (although the C++ standard does - see My suggestion is that you should try to redesign your codes and avoid template specializations whenever possible.

Alternatively, you can try looking for an update to VC++ 6.0 compiler. Perhaps, Microsoft has issued an update to fix the bug.

Zech
 
I ran into this problem before... I believe what I did was for template classes was move the default #include "stdafx.h" to the bottom of the cpp file. I dont have my code here at work so I dont know if this is the exact answer.

Matt
 
Just called up my wife, yep... that is what i did :-P Hope it works for you :-)

Matt
 
Thanks guys for your help!
Actually I found out that VC++ 6.0 can have template function inside template class to be implemented when I declare it.. So I sort of managed the problem. :-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top