Included file not found, but I don't know why

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Anna Smidt

    Included file not found, but I don't know why

    I have declared an include file:

    // gsl.config must be included for correct build with inline correctly
    defined etc.
    #include "gsl/config.h"

    And the compiler says:
    Error 4 fatal error C1083: Cannot open include file: 'gsl/config.h': No
    such file or directory

    But it's in the subfolder c:\MYPROJECT\gs l\gsl\config.h

    Additionally I have set this directory to be included by going to the
    VC++ Project settings and defining the path
    C:\MYPROJECT\gs l\
    and
    C:\MYPROJECT\gs l\gsl

    Can somebody tell me how he would go on now?

    Thanks again.
    Anna

  • Anna Smidt

    #2
    Re: Included file not found, but I don't know why

    It only works when I specify full paths... something like that:

    #include "C:\MyProject\g sl\gsl\config.h "

    But not if I do it like this:
    #include "gsl/config.h"

    I don't know what I did wrong.

    Anna

    Comment

    • David Lowndes

      #3
      Re: Included file not found, but I don't know why

      >It only works when I specify full paths... something like that:
      >
      >#include "C:\MyProject\g sl\gsl\config.h "
      >
      >But not if I do it like this:
      >#include "gsl/config.h"
      >
      >I don't know what I did wrong.
      Perhaps the relative path isn't quite right - does it need ..\
      prepending perhaps?

      Dave

      Comment

      • David Wilkinson

        #4
        Re: Included file not found, but I don't know why

        Anna Smidt wrote:
        I have declared an include file:
        >
        // gsl.config must be included for correct build with inline correctly
        defined etc.
        #include "gsl/config.h"
        >
        And the compiler says:
        Error 4 fatal error C1083: Cannot open include file:
        'gsl/config.h': No such file or directory
        >
        But it's in the subfolder c:\MYPROJECT\gs l\gsl\config.h
        >
        Additionally I have set this directory to be included by going to the
        VC++ Project settings and defining the path
        C:\MYPROJECT\gs l\
        and
        C:\MYPROJECT\gs l\gsl
        Anna:

        Where is the file that contains the statement

        #include "gsl/config.h"

        If config.h is in

        c:\MYPROJECT\gs l\gsl

        then the originating file should be in

        c:\MYPROJECT\gs l

        When you define additional directories you would need to specify

        C:\MYPROJECT\gs l

        Note that the trailing backslash is not needed here, and could be the cause of
        the problem.

        Note also that if you add this directory (either in the project or the VC
        settings) then you can (I would say should) use the angle bracket form

        #include <gsl/config.h>

        --
        David Wilkinson
        Visual C++ MVP

        Comment

        • Anna Smidt

          #5
          Re: Included file not found, but I don't know why

          What do you mean by "originatin g file", please? Do you mean "config.h"
          or do you mean the file where #include <gsl/config.his written?
          If config.h is in
          >
          c:\MYPROJECT\gs l\gsl
          >
          then the originating file should be in
          >
          c:\MYPROJECT\gs l
          >
          When you define additional directories you would need to specify
          >
          C:\MYPROJECT\gs l
          >
          Note that the trailing backslash is not needed here, and could be the
          cause of the problem.
          >
          Note also that if you add this directory (either in the project or the
          VC settings) then you can (I would say should) use the angle bracket form
          >
          #include <gsl/config.h>
          >

          Comment

          • David Wilkinson

            #6
            Re: Included file not found, but I don't know why

            Anna Smidt wrote:
            What do you mean by "originatin g file", please? Do you mean "config.h"
            or do you mean the file where #include <gsl/config.his written?
            Yes, I mean the file where the #include statement is written. Wasn't this
            obvious from the part of my post that you did not quote?

            Also, if config.h is in c:\MYPROJECT\gs l\gsl then it is not in c:\MYPROJECT\gs l,
            so that could not have been my meaning.

            --
            David Wilkinson
            Visual C++ MVP

            Comment

            • Anna Smidt

              #7
              Re: Included file not found, but I don't know why

              I have managed to make it, but I don't understand why it works.
              At first I had these additional include directories:

              \PROGRA~1\OpenC V\cv\include;\P ROGRA~1\OpenCV\ cxcore\include; \PROGRA~1\OpenC V\otherlibs\hig hgui;..\regex;. .\gsl;..\gsl\gs l;..\image;..\j peg;..\mat;..\r owley;..\stasm; ..\tasm;

              Then I added the explicit path (see end of line), and it worked:

              \PROGRA~1\OpenC V\cv\include;\P ROGRA~1\OpenCV\ cxcore\include; \PROGRA~1\OpenC V\otherlibs\hig hgui;..\regex;. .\gsl;..\gsl\gs l;..\image;..\j peg;..\mat;..\r owley;..\stasm; ..\tasm;"C:\MyP roject\gsl";"C: \MyProject\gsl\ gsl"

              It is unclear to me why

              ...\gsl;..\gsl\ gsl;..

              doesn't did resolve to

              "C:\MyProject\g sl\gsl"
              "C:\MyProject\g sl"

              Anna

              Comment

              • David Wilkinson

                #8
                Re: Included file not found, but I don't know why

                Anna Smidt wrote:
                I have managed to make it, but I don't understand why it works.
                At first I had these additional include directories:
                >
                \PROGRA~1\OpenC V\cv\include;\P ROGRA~1\OpenCV\ cxcore\include; \PROGRA~1\OpenC V\otherlibs\hig hgui;..\regex;. .\gsl;..\gsl\gs l;..\image;..\j peg;..\mat;..\r owley;..\stasm; ..\tasm;
                >
                >
                Then I added the explicit path (see end of line), and it worked:
                >
                \PROGRA~1\OpenC V\cv\include;\P ROGRA~1\OpenCV\ cxcore\include; \PROGRA~1\OpenC V\otherlibs\hig hgui;..\regex;. .\gsl;..\gsl\gs l;..\image;..\j peg;..\mat;..\r owley;..\stasm; ..\tasm;"C:\MyP roject\gsl";"C: \MyProject\gsl\ gsl"
                >
                >
                It is unclear to me why
                >
                ..\gsl;..\gsl\g sl;..
                >
                doesn't did resolve to
                >
                "C:\MyProject\g sl\gsl"
                "C:\MyProject\g sl"
                Anna:

                When you add additional directories to the project, relative paths are relative
                to the project file (.vcproj). If this file is in C:\MyProject then ..\gsl is
                C:\gsl (which does not exist).

                What happens if you just add "gsl" to the directory list?

                --
                David Wilkinson
                Visual C++ MVP

                Comment

                • Pavel A.

                  #9
                  Re: Included file not found, but I don't know why

                  Relative paths in includes, etc. are relative to the directory of the
                  ..vcproj file.
                  Maybe your .vcproj is located not in same directory with the .cpp files

                  --PA


                  "Anna Smidt" <a.smidt@nospam gmail.comwrote in message
                  news:#vKrG9hNJH A.5024@TK2MSFTN GP02.phx.gbl...
                  I have declared an include file:
                  >
                  // gsl.config must be included for correct build with inline correctly
                  defined etc.
                  #include "gsl/config.h"
                  >
                  And the compiler says:
                  Error 4 fatal error C1083: Cannot open include file: 'gsl/config.h': No
                  such file or directory
                  But it's in the subfolder c:\MYPROJECT\gs l\gsl\config.h
                  >
                  Additionally I have set this directory to be included by going to the VC++
                  Project settings and defining the path
                  C:\MYPROJECT\gs l\
                  and
                  C:\MYPROJECT\gs l\gsl
                  >
                  Can somebody tell me how he would go on now?
                  >
                  Thanks again.
                  Anna
                  >

                  Comment

                  Working...