Unable to open included file

This is a discussion on Unable to open included file within the C Programming forums, part of the General Programming Boards category; hi, i am a new bie to c programming. when i am trying to execute one c program,some header files ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Posts
    6

    Unable to open included file

    hi,

    i am a new bie to c programming.

    when i am trying to execute one c program,some header files are accessible,while some others are not accessible.

    for example


    #include <stdlib.h>
    #include "../toolkit.h"
    #include "../ngram.h"
    #include "../evallm.h"
    #include "../idngram2lm.h"
    the first four header files are accessible,the fifth one is in the same location,but while executing results the following error.

    UNABLE TO OPEN INCLUDED FILE '../idngram2lm.h'

    the header file is in the same location of the other four header files.Is this due to anything wrong with the header file ?
    please guide me
    how can i resolve this issue?

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Are you sure the name is identical to the name of the file?

  3. #3
    Registered User
    Join Date
    Apr 2010
    Posts
    6
    yes i am sure,The name is identical to the name of the file.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    It's not, or it's not there, or you don't have permissions to use it.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Registered User
    Join Date
    Apr 2010
    Posts
    6
    hi,

    i have tried with a test file including the header file.But the result the same.

    Please find the header file in this link

    idngram2lm.h

    I coundn't find any issue with file.

    please help me to find out the issue.

  6. #6
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Quote Originally Posted by quzah View Post
    it's not there, or you don't have permissions to use it.
    There really is no other explanation at this point.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  7. #7
    Registered User
    Join Date
    Sep 2008
    Location
    /home/australia
    Posts
    2
    What compiler, and OS are you using perhaps if you are using a windows compiler it doesn't recognise the forward slash because windows uses a backslash (\) to signify different directories. That's is all that I can think of because if the file name is exactly spelt correctly(case sensitive), it should work?

  8. #8
    Registered User
    Join Date
    Jun 2005
    Posts
    6,295
    Quote Originally Posted by cthug View Post
    What compiler, and OS are you using perhaps if you are using a windows compiler it doesn't recognise the forward slash because windows uses a backslash (\) to signify different directories. That's is all that I can think of because if the file name is exactly spelt correctly(case sensitive), it should work?
    The win32 API functions accept forward and back slashes interchangeably in paths.

    The file might be there, but the filename has probably being munged, or something is preventing the file being opened (eg file protections, another process having the file open for writing).

    If the drive on which the files are stored has a FAT file system (which supports only the 8.3 filename scheme) the filename may be munged, so the file appears on disk with a different name. This may also be relevant if the compiler is relatively old, and converts the long file name (this filename exceeds the 8.3 spec) into an 8.3 name, and attempts to actually open that.

    It is possible the filename is actually something that is visually similar but actually different. For example idngram2lm.h versus idngram2Im.h
    Right 98% of the time, and don't care about the other 3%.

  9. #9
    Registered User
    Join Date
    Sep 2008
    Location
    /home/australia
    Posts
    2
    Quote Originally Posted by grumpy View Post
    The win32 API functions accept forward and back slashes interchangeably in paths.
    sorry, I don't use windows .

    Quote Originally Posted by grumpy View Post
    It is possible the filename is actually something that is visually similar but actually different. For example idngram2lm.h versus idngram2Im.h
    unlikely, the file jaisha uploaded matched the filename in his source

  10. #10
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    Hmmm. What if there is something like this in one of the other includes:

    Code:
    #define id "BLAH"
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  11. #11
    WDT
    WDT is offline
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Tell us your OS and compiler.
    Make sure something isn't using the file.
    Although it shouldn't be an issue, but try re-naming a copy of the same file with just alphabetical letters (I notice that's the only thing that differs the problematic file from the others).
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  12. #12
    Registered User
    Join Date
    Oct 2008
    Posts
    1,262
    You do realize these filenames are CaSe SenSiTiVe, don't you? That is, abc.h is NOT the same as Abc.h or ABC.h. So make sure the Capitalisation of your file is right.

  13. #13
    Registered User
    Join Date
    Apr 2010
    Posts
    6
    thanks for the replies.

    Now it works.

    I have tried like changing the name from idngram2lm.h to idngr.h.this works fine.

    This may also be relevant if the compiler is relatively old, and converts the long file name (this filename exceeds the 8.3 spec) into an 8.3 name, and attempts to actually open that.
    i dont know how to find the version of the compiler.

    now it works.

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-21-2008, 11:19 PM
  2. Unable to open include file SDL_audio.h
    By rraj.be in forum C Programming
    Replies: 2
    Last Post: 06-28-2008, 08:04 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM

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