Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8502657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:32:47+00:00 2026-06-11T01:32:47+00:00

I have a header defined as follows header #pragma once #include <map> #include <string>

  • 0

I have a header defined as follows

header

#pragma once

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


class TextureAtlas
{
public:
    TextureAtlas(std::string fileName);
    ~TextureAtlas(void);

    // 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();

private:
    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

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);
    filePath.append(fileName);

    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(
            settings.entries(i).x(),
            settings.entries(i).y(),
            settings.entries(i).height(),
            settings.entries(i).width()
            );
    }
}

TextureAtlas::~TextureAtlas(void)
{
}

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?!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T01:32:49+00:00Added an answer on June 11, 2026 at 1:32 am

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

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a template defined in my header file as follows: template<typename T> class
in header file I have defined the following function #ifndef OS_H #define OS_H #include
All, i have the following model defined, class header(models.Model): title = models.CharField(max_length = 255)
I have this class header //header for class. #ifndef Container_H #define Container_H #include <iostream>
I have a struct defined in a header as follows: #define LC_ERR_LEN 300 typedef
I have two classes as follows in a header file template<size_t N> class Parent{
I have defined a format like this: # header format format STDOUT_TOP = pid
I have a data structure defined as struct myDataStruct { int32_t header; int16_t data[8];
I currently have a custom TabItem which has a custom header, which is defined
The situation is as follows. I have to send a defined XML to an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.