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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Include Files and Folder Structure

Include Files and Folder Structure

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestioncsharpvisual-studiotutorial
5 Posts 4 Posters 0 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.
  • P Offline
    P Offline
    pgav
    wrote on last edited by
    #1

    Hello there! I've got a project with a folder structure similar to the following - folderA - subFolderA - folderB - subFolderB All of the folders and sub folders have source code and header files in them. That is actually my problem. Say, for example, I have a source file in folderB, and a header file in folderA, how do I show Visual Studio the location of the file without providing an absolute path on my computer (like c:\project\folderA\header.h)? Is there a way to provide a relative pointer to the folder? As always, thanks for your help in advance.

    Patrick

    C C 2 Replies Last reply
    0
    • P pgav

      Hello there! I've got a project with a folder structure similar to the following - folderA - subFolderA - folderB - subFolderB All of the folders and sub folders have source code and header files in them. That is actually my problem. Say, for example, I have a source file in folderB, and a header file in folderA, how do I show Visual Studio the location of the file without providing an absolute path on my computer (like c:\project\folderA\header.h)? Is there a way to provide a relative pointer to the folder? As always, thanks for your help in advance.

      Patrick

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      pgav wrote:

      Is there a way to provide a relative pointer to the folder?

      you can use relative paths : "../folderA/subfolderB"

      image processing | blogging

      1 Reply Last reply
      0
      • P pgav

        Hello there! I've got a project with a folder structure similar to the following - folderA - subFolderA - folderB - subFolderB All of the folders and sub folders have source code and header files in them. That is actually my problem. Say, for example, I have a source file in folderB, and a header file in folderA, how do I show Visual Studio the location of the file without providing an absolute path on my computer (like c:\project\folderA\header.h)? Is there a way to provide a relative pointer to the folder? As always, thanks for your help in advance.

        Patrick

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        Yes, you can use "..\" to specify to look in the parent folder. Example: In file from folderB: #include "..\FolderA\MyFile.h"


        Cédric Moonen Software developer
        Charting control

        P 1 Reply Last reply
        0
        • C Cedric Moonen

          Yes, you can use "..\" to specify to look in the parent folder. Example: In file from folderB: #include "..\FolderA\MyFile.h"


          Cédric Moonen Software developer
          Charting control

          P Offline
          P Offline
          pgav
          wrote on last edited by
          #4

          Thanks a lot! :)

          Patrick

          Z 1 Reply Last reply
          0
          • P pgav

            Thanks a lot! :)

            Patrick

            Z Offline
            Z Offline
            Zac Howland
            wrote on last edited by
            #5

            You can also add the relative (or absolute) path of the other directory to the project's additional include's in your project settings.

            If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

            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