Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to add full path #include ?

how to add full path #include ?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
18 Posts 6 Posters 89 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Mircea NeacsuM Mircea Neacsu

    That seems like a full Linux path to me

    Mircea

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #5

    Could be. That's what I get for making an assumption of Windows.

    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

    1 Reply Last reply
    0
    • Mircea NeacsuM Mircea Neacsu

      That seems like a full Linux path to me

      Mircea

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #6

      ... and a removable one at that! :-D

      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

      1 Reply Last reply
      0
      • L Lost User

        I have never add #include using full path. My code is obviously missing something and the error ( file not found ) is not helping much to fix it. Help will be greatly appreciated.

        #include "/media/nov25-1/MDI_BACKUP_DEC10/BLUETOOTH/BT_LIBRARY/CCC_SOURCE/Bluetoothctl_Dialog/mainwindow_bluewtoothctl_dialog.h"

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #7

        Salvatore Terress wrote:

        and the error ( file not found ) is not helping much to fix it.

        Well that is easy to correct. Work your way down that path starting in directory /media, to see whether all the subdirectories exist. And oncel you reach the last one, see if the file is there, or if it is possibly mis-spelled. The problem for us with such issues is that we have no access to your system so cannot do any of the searching. But it is usually not best practice to use full paths in your #include statements. Just us the name of the header file and add its path to the list of directories in the include list - either by use of the -I option to the compiler, or the relevant environment variable (see man page for details).

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          You keep saying "full path", but your example never starts with a drive letter, so taht would be a good place to start.

          Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #8

          Seems to be full path to me. Windows and Linux. The alternative is a partial path. And it is certainly not that. Not in either OS.

          D 1 Reply Last reply
          0
          • J jschell

            Seems to be full path to me. Windows and Linux. The alternative is a partial path. And it is certainly not that. Not in either OS.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #9

            It's partial path on Windows. The first / assumes "the current drive", whatever that is at the time.

            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

            K J 2 Replies Last reply
            0
            • D Dave Kreskowiak

              It's partial path on Windows. The first / assumes "the current drive", whatever that is at the time.

              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

              K Offline
              K Offline
              k5054
              wrote on last edited by
              #10

              I'm pretty sure that's a Linux path. On my Ubuntu system, when I use the GUI to mount removable media it's mounted as /media/k5054/_Partition_, where Partition is the partition label or UUID, etc. Unless the OP has the same media mounted, the compiler isn't going to find it. But one should use relative paths in general, and use -I flags to tell the compiler/pre-processor where to search. Ditto -L flags to the linker to tell it where to find libraries.

              "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

              D 1 Reply Last reply
              0
              • K k5054

                I'm pretty sure that's a Linux path. On my Ubuntu system, when I use the GUI to mount removable media it's mounted as /media/k5054/_Partition_, where Partition is the partition label or UUID, etc. Unless the OP has the same media mounted, the compiler isn't going to find it. But one should use relative paths in general, and use -I flags to tell the compiler/pre-processor where to search. Ditto -L flags to the linker to tell it where to find libraries.

                "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #11

                I should have been more specific. If that path was on Windows, it would have been a partial path. I understand it's a Linux path.

                Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                1 Reply Last reply
                0
                • D Dave Kreskowiak

                  It's partial path on Windows. The first / assumes "the current drive", whatever that is at the time.

                  Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                  J Offline
                  J Offline
                  jschell
                  wrote on last edited by
                  #12

                  Dave Kreskowiak wrote:

                  The first / assumes "the current drive", whatever that is at the time.

                  Yes I know how pathing works in unix (and linux) and windows. There are only two terms that I know. So if you know of another please provide the term and definition. - Partial path. - Full path. Are you claiming that the first forward slash on a windows file path only means a 'partial path' but on unix/linux it always means a 'full path'? On linux/unix the path might have a path that resolves to a different drive. Otherwise, just like windows, it resolves to the current drive. Thus it is in deemed a 'full path' on windows and unix/linux. In terms of this forum which would be relevant for C/C++ include file paths... A partial path in an include path on both types of OS will use the rules associated with the build process to resolve the path. That can either be because it defined a 'current' directory or it will resolve to the execution directory (or some variant.) A full path (forward slash) in an include path on both types of OS will end up using the current drive excepting of course unless there is a path resolution to a different drive for linux/unix.

                  D K 2 Replies Last reply
                  0
                  • J jschell

                    Dave Kreskowiak wrote:

                    The first / assumes "the current drive", whatever that is at the time.

                    Yes I know how pathing works in unix (and linux) and windows. There are only two terms that I know. So if you know of another please provide the term and definition. - Partial path. - Full path. Are you claiming that the first forward slash on a windows file path only means a 'partial path' but on unix/linux it always means a 'full path'? On linux/unix the path might have a path that resolves to a different drive. Otherwise, just like windows, it resolves to the current drive. Thus it is in deemed a 'full path' on windows and unix/linux. In terms of this forum which would be relevant for C/C++ include file paths... A partial path in an include path on both types of OS will use the rules associated with the build process to resolve the path. That can either be because it defined a 'current' directory or it will resolve to the execution directory (or some variant.) A full path (forward slash) in an include path on both types of OS will end up using the current drive excepting of course unless there is a path resolution to a different drive for linux/unix.

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #13

                    Quote:

                    just like windows, it resolves to the current drive.

                    This is what I'm calling a partial path. I'm not calling out anyone for anything here. I made a mistake because I assumed Windows. My mistake also shows that I don't do Linux very much, like once every couple of years so I have re-learn this crap every time.

                    Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                    K J 2 Replies Last reply
                    0
                    • J jschell

                      Dave Kreskowiak wrote:

                      The first / assumes "the current drive", whatever that is at the time.

                      Yes I know how pathing works in unix (and linux) and windows. There are only two terms that I know. So if you know of another please provide the term and definition. - Partial path. - Full path. Are you claiming that the first forward slash on a windows file path only means a 'partial path' but on unix/linux it always means a 'full path'? On linux/unix the path might have a path that resolves to a different drive. Otherwise, just like windows, it resolves to the current drive. Thus it is in deemed a 'full path' on windows and unix/linux. In terms of this forum which would be relevant for C/C++ include file paths... A partial path in an include path on both types of OS will use the rules associated with the build process to resolve the path. That can either be because it defined a 'current' directory or it will resolve to the execution directory (or some variant.) A full path (forward slash) in an include path on both types of OS will end up using the current drive excepting of course unless there is a path resolution to a different drive for linux/unix.

                      K Offline
                      K Offline
                      k5054
                      wrote on last edited by
                      #14

                      For unix-like systems there are two terms in general use: absolute path: any path that starts with a / relative path: a path relative to the current directory. This is any path that does not start with a / Some examples might be src/projects/foo/bar.c or ../include or ./program

                      jschell wrote:

                      On linux/unix the path might have a path that resolves to a different drive

                      Technically true. For example, you might have /home mounted as a separate drive - it might even be a network drive. For the average user, the file system is homogeneous, that is you can navigate to any point in the file tree with out having to know if it's on a separate drive/partition,networked-fs, etc. Its only really an issue for applications that may want to move files from one location to another, as you can not use link() and unlink() to move a file to a different place in the file tree if the source and target are in different file systems. Edit: It should be noted that file systems may be mounted at any level, so you might have a partition mounted as /home, and another partition mounted as /home/games, and yet another mounted as /home/games/adventure.

                      "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                      J 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        Quote:

                        just like windows, it resolves to the current drive.

                        This is what I'm calling a partial path. I'm not calling out anyone for anything here. I made a mistake because I assumed Windows. My mistake also shows that I don't do Linux very much, like once every couple of years so I have re-learn this crap every time.

                        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                        K Offline
                        K Offline
                        k5054
                        wrote on last edited by
                        #15

                        Dave Kreskowiak wrote:

                        My mistake also shows that I don't do Linux very much, like once every couple of years so I have re-learn this crap every time

                        Ditto, but in reverse!

                        "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                        1 Reply Last reply
                        0
                        • K k5054

                          For unix-like systems there are two terms in general use: absolute path: any path that starts with a / relative path: a path relative to the current directory. This is any path that does not start with a / Some examples might be src/projects/foo/bar.c or ../include or ./program

                          jschell wrote:

                          On linux/unix the path might have a path that resolves to a different drive

                          Technically true. For example, you might have /home mounted as a separate drive - it might even be a network drive. For the average user, the file system is homogeneous, that is you can navigate to any point in the file tree with out having to know if it's on a separate drive/partition,networked-fs, etc. Its only really an issue for applications that may want to move files from one location to another, as you can not use link() and unlink() to move a file to a different place in the file tree if the source and target are in different file systems. Edit: It should be noted that file systems may be mounted at any level, so you might have a partition mounted as /home, and another partition mounted as /home/games, and yet another mounted as /home/games/adventure.

                          "A little song, a little dance, a little seltzer down your pants" Chuckles the clown

                          J Offline
                          J Offline
                          jschell
                          wrote on last edited by
                          #16

                          k5054 wrote:

                          Technically true.

                          You know that on Windows I can map a different drive to a directory in the current drive file system right?

                          1 Reply Last reply
                          0
                          • D Dave Kreskowiak

                            Quote:

                            just like windows, it resolves to the current drive.

                            This is what I'm calling a partial path. I'm not calling out anyone for anything here. I made a mistake because I assumed Windows. My mistake also shows that I don't do Linux very much, like once every couple of years so I have re-learn this crap every time.

                            Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                            J Offline
                            J Offline
                            jschell
                            wrote on last edited by
                            #17

                            Dave Kreskowiak wrote:

                            This is what I'm calling a partial path.

                            Just to be clear what exactly do you think that the following does on Windows? On Linux? Specifically is there any realistic difference between the two in general?

                            #include "/work/x/y/TestClass.h"

                            D 1 Reply Last reply
                            0
                            • J jschell

                              Dave Kreskowiak wrote:

                              This is what I'm calling a partial path.

                              Just to be clear what exactly do you think that the following does on Windows? On Linux? Specifically is there any realistic difference between the two in general?

                              #include "/work/x/y/TestClass.h"

                              D Offline
                              D Offline
                              Dave Kreskowiak
                              wrote on last edited by
                              #18

                              Just to be clear, I'm done with this.

                              Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups