• ### Popular Now

• 13
• 15
• 27
• 9
• 9

#### Archived

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

# A nudge in the right direction //compile error

This topic is 5336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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 on other sites
// EITHER#include <vector>using namespace std; // !!!vector<something> myVector;// OR#include <vector>std::vector<something> myVector;

That should to the trick?

##### Share on other sites
Did you, by any chance, declare a variable named ''vector''?

##### Share on other sites

I declared using std::vector

then later

vector<BITMAP_INFO> variable;

BITMAP_INFO is a struct.

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 on other sites
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.

Ok, Ill try it

##### Share on other sites
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!