Cannot open include file

This is a discussion on Cannot open include file within the C++ Programming forums, part of the General Programming Boards category; Does anyone know what's up with this? It says "c:\program files\microsoft visual studio\myprojects\calendarlist\testeroo.cxx(1) : fatal error C1083: Cannot open include ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    Cannot open include file

    Does anyone know what's up with this?

    It says "c:\program files\microsoft visual studio\myprojects\calendarlist\testeroo.cxx(1) : fatal error C1083: Cannot open include file: 'Calendar.hxx': No such file or directory", but in the workspace pane, there is a file sitting there under the "Header Files" directory titled "Calendar.hxx". The program was compiling just fine before, and I was fixing run-time errors, then all of a sudden I get this. I spelled Calendar the same, and both with capital C's and everything.
    What else could be wrong?

    Thanks,
    Sean Michael Simonsen

  2. #2
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    Maybe you threw a semicolon somewhere in the program while you were debugging by accident. Or forgot to end brackets for if statemens/loops. Those small errors always end up causing all sorts of wierd errors.

    Ever accidentally put a semicolon after a for loop and try to compile. Jeeze, I was sitting there for 15 minutes just scratching my head wondering what i did wrong (couldn't find it!) lol.

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    This is just plain stupid

    I'm getting ........ed off at this thing. In order to find what file my mistake was in, if there was one, I replaced the main file with a new one that did nothing but contain a main function and include Calendar.hxx. This had the same problem. Then, I commented out the entire Calendar.cxx file (the function definitions for my calendar class), and it worked fine, so I figured the mistake was in there. Then, I took out the comment characters /* ... */, recompiled, and it compiled fine. These are the ONLY things I did. So it went like this:

    1. Replaced main file with file containing only #include statement, and int main(){ return( 0 ); } - no success, same error
    2. Attempted to compile - no success, same error
    3. Added /* and */ to front and end of file - successfully compiled
    4. Deleted /* and */ from step 2 - successfully compiled

    I'm glad this thing's working and all now, but I'm even more confused than when I started. I am 100% sure that I didn't do anything else, as I was careful to record every step in order to ensure I didn't change something without realizing it, and so I could change things back if need be.

    I'll cool down and forget about it now, I suppose.
    ~Sean Michael Simonsen

  4. #4
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    I hate computers

    It was working fine for a while, and now it's not. Once again, it failed to open the Calendar.hxx file. This time, to test whether it was the Calendar file that was F'd up, or something else, I used #include "Event.hxx" (even.hxx is included in calendar.hxx, btw, and I do use #ifndef #define's to be sure it doesn't compile too much). I got the same error saying that it couldn't find Event.hxx. This is after it had been including both of them successfully dozens of times. I don't know what I did. I didn't move the files around or anything, but it just stopped working. I then did the following code for my main file:

    #include <iostream.h>
    void main(){}

    and came up with 109 errors in iostream.h. They were mostly things like ambiguous definition, which is odd because I have NEVER messed around with that file, no one else has on my computer, and I was using it just fine earlier today. I then deleted my main file from the workspace, added a new one, did the exact same code (#include <iostream.h> \n void main(){}), and it compiled successfully. I now have the following code:

    //test.cxx
    Code:
    #include "Event.hxx"
    
    void main(){}
    //Event.hxx
    Code:
    #ifndef EVENT_HXX
    #define EVENT_HXX
    /*
    commented out enums and #includes
    */
    class Event
    {
    /*
    commented out all methods and variables
    */
    };
    #endif
    //Event.cxx
    Code:
    #include "Event.hxx"
    /*
    commented out all function definitions
    */
    Those are the only 3 files currently in my workspace, and that is ALL the code that is not commented out. I can tell because all the rest of it is green. I have made extra sure that I didn't forget to comment anything out.

    I am getting extremely frustrated, as I really can't continue working on my class project (I'm doing the calendar portion of a personal finance manager in Win32). Considering I only have about 9 lines of code now in 3 files, I am pretty sure it's no bug of mine. I don't know what would be causing this. I haven't installed any new software in at least a month, and I've been using msvc++6 for about 2 years w/o uninstalling it. I have a virus scanner and firewall, and have no clue what is causing this. Maybe I should give up programming. Please help if you can, because I am completely lost.

    ~Sean Michael Simonsen
    ~Sean Michael Simonsen

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    18

    My solution

    I'm now putting everything in one file... no worries.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    73
    I hate when I get wierd errors like that... Sometimes just typing the whole thing over fixes the problem. If it's not necissary for you to use multiple files, don't bother with it. You can always tinker around more with it on your next project.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 11:12 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21