• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

VC 5.0 strange error

here are the snippets involved (dots to maintain indenting):

namespace ZData
{
class ChannelData
{
//snip
protected:
...friend class ZFile::RawDataFile;
...std::vector<short> horz, vert;
//snip
};
}

namespace XPlat
{
class File
{
//snip
...void read(void* dest, size_type unit_size, size_type num_vals) throw(BadReadWrite);
...template <typename T>
...void read(T& val) throw(BadReadWrite);
//snip
};
}

namespace ZFile
{
class RawDataFile
{
//snip
...std::vector<ZData::ChannelData> data_channels;
//snip
};
}

ZFile::RawDataFile(const std::string& path)
{
...XPlat::File file;
//snip
...try {
......for (unsigned i = 0; i < num_slices; i++)
.........for(unsigned j = 0; j < data_channels.size(); j++)
.........{
............file.read(data_channels[i].horz[i]);  //error
............file.read(data_channels[i].vert[i]);  //error
.........}
...}
//snip
}

Anyway, I am getting an error at each of the lines noted above:
error 2661: 'read' : no overloaded function takes 2 parameters

I'm really not sure what is going on here.  I've tried putting an extra pair of parens in the read, but I'm coming up with nothing.
0
sosedada
Asked:
sosedada
  • 6
  • 6
1 Solution
 
nietodCommented:
Is this for VC 6?  VC 5 does not support template member functions.

You might try renaming the non-template read() function and seeing if the problem goes away.
0
 
sosedadaAuthor Commented:
Well, I guess I'm wasting my time of VC5, tried changed the template read to readVal and now it says readVal doesn't take 1 argument.

So I took my code to a friends machine (VC6 sp3) and when I rely on type deduction I get:
RawDataFile.cpp(82) : error C2893: Failed to specialize function template 'void __thiscall XPlat::SwapFile::readVal(T &)'
        With the following template arguments:
        'short'

Naturally, 2893 is one of the errors not documented in the help.  Not that it would do any good.

So I tried making it
file.readVal<short>(...);
and get:
RawDataFile.cpp(81) : error C2062: type 'short' unexpected


And to top it all off in another file I got an internal compiler error on:
template <typename HeaderClass, unsigned long DataType>
class TemplateHeaderMaker: public HeaderMaker

I don't know why I agreed to work on this project with this non-conforming compiler.  Help, please!
0
 
nietodCommented:
>> non-conforming compiler
There isn't one yet that conforms intirely to the standard.  Gcc is close, but still not intirely there.

Wait a second, what is

ZFile::RawDataFile(const std::string& path)
{
....XPlat::File file;
//snip
....try {
.......for (unsigned i = 0; i < num_slices; i++)
..........for(unsigned j = 0; j < data_channels.size(); j++)
..........{
.............file.read(data_channels[i].horz[i]);  //error
.............file.read(data_channels[i].vert[i]);  //error
..........}
....}
//snip
}

ZFile:: is a namespace, not a class name.  so RawDataFile() presented there is a global function inside the namespace, not the class.  That's nt what you want, right?
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
sosedadaAuthor Commented:
sorry, that is the contructor, I left out a RawDataFile::

Since VC 5 doesn't support member function templates, I can settle for read(<handwritten data type>).  But I need to be able to compile this on VC 6.  Am I going to have to use a support call on that ICE?  Or does anyone know anything about whats going on there?
0
 
nietodCommented:
Its hard to tell what the problem is with this little code snippet.  From what I can see, it should work fine, but I can't say for sure.
0
 
sosedadaAuthor Commented:
All I know is the code with the ICE works on VC5
0
 
nietodCommented:
I don't understand.  I thought you said it doesn't work.
0
 
sosedadaAuthor Commented:
The template function doesn't work.  I have given up on that for now.  However, I discovered an Internal Compiler Error when I built using VC6.  This happens on the class declaration noted above with unsigned long DataType as one of the template parameters.
0
 
nietodCommented:
The compiler errors are usually caused by syntax errors that the compiler can't handle.  You cna usually track them down by commenting out large portions of the code until the problem goes away, then bring back peices of code until it returns, and continue this process until you narrow in on the section that is causing the problem.   Its a big pain to do this, but fortunately they don't happen often.  (I don't think I've seen one in more than a year.)
0
 
sosedadaAuthor Commented:
We may not have gotten the results I hoped for, but things are working and I got rid of that ICE also.  Thanks.
0
 
nietodCommented:
You're welcome.  but I really didn't think I did anything, otherwise I would have answered.
0
 
sosedadaAuthor Commented:
I understand, but I you helped me enough that I didn't want to delete the question.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now