Ok, so I'm working with some code from our book given to us for a priority queue. I've changed around the insert function to accommodate my needs, and I'm generating one lone error on compile. However, the error is because the compiler is using the old definition of the function.
Old definition of PQueueInsert from PQ.h
virtual void PQueueInsert(const pqItemType& NewItem;
My revised definition from PQ.h
virtual void PQueueInsert(int track, int time);
The line of code generating the error from driver.cpp and the error
forwardPQ.PQueueInsert( track, T );
c:\visual studio 2005\projects\disk sweep\disk sweep\driver.cpp(211) : error C2660: 'pqClass::PQueueInsert' : function does not take 2 arguments
If I change the line of code to have only 1 parameter and thwe subsequent error:
forwardPQ.PQueueInsert( track );
c:\visual studio 2005\projects\disk sweep\disk sweep\driver.cpp(211) : error C2664: 'pqClass::PQueueInsert' : cannot convert parameter 1 from 'int' to 'const pqItemType &'
Reason: cannot convert from 'int' to 'const pqItemType'
No constructor could take the source type, or constructor overload resolution was ambiguous
So it seems to me its still hanging on to the old definition of the function. I have already tried Rebuilding it, with the same results.
Also, in Visual Studio 2005, how the hell do I get my file menu toolbar back? Dam thing disappeared, and I can't find any option for it anywhere. Its annoying not having save all and open buttons anymore.
Posts
Did you change the arguments of the function definition (in the .cpp file) to reflect your changes? The only thing I can think of off the top of my head that would cause this problem is if you overloaded the function but forgot to do that.
Thats why I'm so puzzled by this. It should work.
See how many books I've read so far in 2010
Actually, if it's not horrendously long can you post the code (class declaration plus the PQueueInsert function definition(s)) here? If there's something subtle going on that'll probably help.
Other than that, if you made the changes to the method signature in a different file than the original, make sure you're #including the right version. But it looks like you're using the same file, so that won't matter.
And yea, file name is the same, so the #include is the same
See how many books I've read so far in 2010
driver.h
PQ.cpp
PQ.h
Heap.cpp
Heap.h
Node.cpp
Node.h
Some info, this is to simulate a disk scheduling program, using priority queues to control the list of tracks to visit on the forward and reverse sweeps of the track arm.
Originally, the heap used KeyedItem, which was just a wrapper for a data type with a function to retrieve that data. I changed it to a node with 2 data items, since I need to put both the track # and a timestamp for that # in there.
See how many books I've read so far in 2010
Track is an int, which won't work with your method's definition on line 19 in PQ.h
Which is typedef-ed as HeapItemType (which consequently becomes typedef-ed as a Node)
If you fix track or change your signature on the method you should be okay. Which do you want it to be?
I saved newer versions of the files in question to a different location, but at compile it was grabbing files from within the folder. I probably should have saw that coming. Lemme try a little file switcharoo...
upon closer inspection, it was grabbing my driver from the alt location just fine, but neglecting PQ.h and PQ.cpp... very odd
yep, that was it. Thanks.
See how many books I've read so far in 2010