A nudge in the right direction //compile error

Started by
5 comments, last by Swatter555 20 years, 8 months ago
My head hurts from this one. This small chunk of code is throwing my VC++6 compiler into fits. Funny thing is; the entire time I was coding the code complete worked fine. Here are some of the compile errors, the first one seems most significant. :\program files\microsoft visual studio\myprojects\fpme\fpme.cpp(464) : error C2653: ''vector >'' : is not a class or namespace name c:\program files\microsoft visual studio\myprojects\fpme\fpme.cpp(464) : error C2065: ''const_iterator'' : undeclared identifier c:\program files\microsoft visual studio\myprojects\fpme\fpme.cpp(464) : error C2146: syntax error : missing '';'' before identifier ''iter'' Globally I defined "using std::vector" I know its probably a stupid error, but any help would be appreciated.

for(vector<BITMAP_INFO>::const_iterator iter = dest.begin();
		    iter != dest.end(); ++iter)
		{
			         
		    if(iter->file_name == file)
			{
			    src_wid = iter->bmp_width;
			    src_hgt = iter->bmp_height;
			    break;
			} //end if

		
		} //end for loop


Advertisement
// EITHER#include <vector>using namespace std; // !!!vector<something> myVector;// OR#include <vector>std::vector<something> myVector;


That should to the trick?
How do I set my laser printer on stun?
Did you, by any chance, declare a variable named ''vector''?
First reply:

I declared using std::vector

then later

vector<BITMAP_INFO> variable;


BITMAP_INFO is a struct.

Second reply:

I dont believe i used vector in any other instance, other than the vector container. Ill check a bit closer.

Thanks for the help so far, though...



[edited by - swatter555 on August 8, 2003 6:13:35 AM]
Yes, but have you tried Wildfire''s solution???
The problem is, I think, that every vector template you use needs it''s own using directive.
And the price we paid was the price men have always paid for achieving paradise in this life -- we went soft, we lost our edge. - "Muad'Dib: Conversations" by the Princess Irulan
Ok, Ill try it
Thank you very much, Wildfire.

I still have alot to learn, but thanks to the smart people here it is bearable.

I was messing around with it before and I did try that, but other parts of the code were in error and made me over look the solution, and at first your post Wildfire. But hey. it works now!


This topic is closed to new replies.

Advertisement