Archived

This topic is now archived and is closed to further replies.

Swatter555

A nudge in the right direction //compile error

Recommended Posts

Swatter555    127
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


Share this post


Link to post
Share on other sites
Wildfire    154

// EITHER

#include <vector>
using namespace std; // !!!


vector<something> myVector;

// OR

#include <vector>

std::vector<something> myVector;


That should to the trick?

Share this post


Link to post
Share on other sites
Swatter555    127
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]

Share this post


Link to post
Share on other sites
Jedyte    122
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.

Share this post


Link to post
Share on other sites
Swatter555    127
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!


Share this post


Link to post
Share on other sites