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

  • Home
  • SEARCH
  • 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 8203759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:40:18+00:00 2026-06-07T07:40:18+00:00

I have a class called File that is defined (along with other classes) in

  • 0

I have a class called File that is defined (along with other classes) in the header “dmanager1.h”. In the “dmanager1.cpp” file (implementation for the dmanager1.h file), when I list the headers in one order I get an error when trying to compile along with my main.cpp (main.cpp is empty except for the header call and an empty “int main()”…basically I’m just testing the class .h and .cpp files)… If I switch the headers around in the dmanager1.cpp file I get no errors. I don’t understand what is happening. The error I’m getting is:
error: ‘File’ does not name a type

I get said error when I have my header’s ordered in my “dmanager1.cpp” as follows:

#include "dmanager1.h"
#include <iostream>
#include <cstring>

If I switch the header’s around to:

 #include <iostream>
 #include <cstring>
 #include "dmanager1.h"

…I don’t get the compilation error. Is the first order getting parsed funny? Any thoughts would be greatly appreciated.

EDIT: Added part of the header in question…

#ifndef _dmanager1_h
#define _dmanager1_h


//--------------------
// Forward References
//--------------------
// Node_L, Node_T, and Sector are defined in File: dmanager1a.h
class Node_L;
class Node_T;
class Sector;



class File
{
        public:
                // Default Constructor
                //File();
                // Constructor: Allowing "name", "size", and/or "permissions" to be set
                // Permissions set to default of 0 == read and write
                File(const char * & name, float size = 0, int permissions = 0) : timestamp(11223333) {};
                // Default Destructor
                ~File();

                //returns an int corresponding to the date modified (mmddyy)
                int get_date_mod(void) const {return timestamp;}

                // Return's current level of permission on the File: 0 = read/write, 1 = read only
                int get_permission(void) const {return permission;}

                // Set's Permission to "level": 0 = read/write, 1 = read only
                int set_permission(int level);

        private:
                // Data members
                char * name;
                float size_OA;

                //function used to update "date modified"
                void update_timestamp(void);

                // Current permission level of the file: 0 = read/write, 1 = read only
                int permission;

                //value modified by update_timestamp() and the value returned by get_date_mod().  Date file last edited.
                int timestamp;

};
  • 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-07T07:40:20+00:00Added an answer on June 7, 2026 at 7:40 am

    Make sure that each of your headers is completely self-sufficient. It needs to #include headers for everything that it uses and not assume that they will be included by something else. Every header should work even if it is the only header that a .c file includes.

    I’m betting that your dmanager1.h header is using something from the standard library and you aren’t including the header that it needs. Swapping the header appears to fix the problem, but it’s only working by coincidence.

    One diagnostic test you can do is to create a .c file that contains nothing but the line #include "dmanager1.h". Try to compile it. If the compiler throws an error, it should provide hints as to which additional headers need to be included.

    Update: I can compile using the initial portion of the header that you posted using g++ -Wall and I get no errors or warnings at all. Please post a sample that reproduces the problem.

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

Sidebar

Related Questions

I have a class header file called Grid.h that contains the following 2 private
I have this class called PollFrame that extends JFrame in a file called PollFrame.java
I have one class, called A, and it has it's own header file. Then
I have a viewmodel called ArticleAdmin that includes a list of checkboxes: public class
I have a function in a class file called auth_user and its in App_code
I have an entity called File, I created a partial class with a property
I have a class called Path for which there are defined about 10 methods,
I have a class called UserInfo that contains details about a given user. There
I have a class called Question that has a property called Type. Based on
I have a class called ReportRequest as: public class ReportRequest { Int32 templateId; List<Int32>

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.