Odd intellisense behaviour in VS2012 using C++. Ignores #include?

I have a header defined as follows

#pragma once

#include <map>      
#include <string>
#include "gl\glew.h"
#include "glm\glm\glm.hpp"

class TextureAtlas
    TextureAtlas(std::string fileName);

    // Returns the index of a sprite from its name
    //int getIndex(std::string name);

    // Returns the source rectangle for a sprite
    glm::vec4 getSourceRectangle(std::string name);

    // Returns the OpenGL texture reference
    GLuint getTexture();

    float getTextureHeight();
    float getTextureWidth();

    float m_height;

    // Holds the sprite name and its index in the texture atlas
    //std::map<std::string, int> m_indices;

    // Holds the source rectangle for each sprite in the texture atlas
    std::map<std::string, glm::vec4> m_sourceRectangles;

    // The texture containing all of the sprite images
    GLuint m_texture;

    float m_width;

I'm getting errors with the following constructor for the associated source

#include "TextureAtlas.h"
#include "Content\Protobuf\TextureAtlasSettings.pb.h"
#include <iostream> 
#include <fstream>                                      // ifstream

#define LOCAL_FILE_DIR "Content\\"

TextureAtlas::TextureAtlas(std::string fileName)
    TextureAtlasSettings::TextureAtlasEntries settings;

    std::string filePath(LOCAL_FILE_DIR);

    ifstream file(filePath, ios::in | ios::binary);     // ERROR!

    if (file.is_open())
        if (!settings.ParseFromIstream(&file)) 
            printf("Failed to parse TextureAtlasEntry");

    int numEntries = settings.entries().size();

    for (int i = 0; i < numEntries; i++)
        m_sourceRectangles[settings.entries(i).name()] = glm::vec4(


The problem is

IntelliSense: identifier "ifstream" is undefined

If I put std:: infront of it (std::ifstream) then that removes the error above but causes the following error

error C2653: 'ios' : is not a class or namespace name

What is going on? It doesn't make any sense as I think I have included everything I need?!


In the code as you posted it you have to prefix the types with the namespace name, i.e. std::ifstream and std::ios.

Need Your Help

Creating Tab Bar using fragments from support package

java android android-layout

Hello I am searching a good example creating my custom Tab Bar (at the bottom) using fragments.

JDBC Template PreparedStatementCallback error HELP?

java sql spring jdbc jdbctemplate

I was testing to transfer data of the result query to a String variable but when I did I received this bunch of errors, I don't have any idea why did this occured, I tested my query in mysql and it

How transferrable is code between Meteor and AngularJS?

javascript angularjs meteor

I'm working on a fairly large web app and right now it consists of an API in Node and a Connect static server that pushes our Angular frontend. I've been absolutely fascinated with Meteor as of la...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.