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. Share functionality

Share functionality

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpannouncement
6 Posts 2 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.
  • J Offline
    J Offline
    JensB
    wrote on last edited by
    #1

    Hi, I have a header file which is included in 1 project which has to be included in another too. I can copy it to the other project and then include it, but when the header changes i have to copy the file again to the other location. How can i easily maintain only 1 version of that file? I have seen i can import a header file from another location, but when i do #include "Myheader.h" or #include the header isn't found neither. Can you help?

    A 1 Reply Last reply
    0
    • J JensB

      Hi, I have a header file which is included in 1 project which has to be included in another too. I can copy it to the other project and then include it, but when the header changes i have to copy the file again to the other location. How can i easily maintain only 1 version of that file? I have seen i can import a header file from another location, but when i do #include "Myheader.h" or #include the header isn't found neither. Can you help?

      A Offline
      A Offline
      Antony M Kancidrowski
      wrote on last edited by
      #2

      You need to ensure that the location of MyHeader.h is in the include path for both of your projects. Ant. I'm hard, yet soft.
      I'm coloured, yet clear.
      I'm fruity and sweet.
      I'm jelly, what am I? Muse on it further, I shall return!
      - David Williams (Little Britain)

      J 1 Reply Last reply
      0
      • A Antony M Kancidrowski

        You need to ensure that the location of MyHeader.h is in the include path for both of your projects. Ant. I'm hard, yet soft.
        I'm coloured, yet clear.
        I'm fruity and sweet.
        I'm jelly, what am I? Muse on it further, I shall return!
        - David Williams (Little Britain)

        J Offline
        J Offline
        JensB
        wrote on last edited by
        #3

        First of all, thanks for the reply. I had included the location of 'Myheader.h' file in the first project like 'C:\vss\'. I knew it was going to be in a subdirectory of 'C:\vss'. I've now replaced it with the exact directory and now the compiler finds the file!! Really strange. (No recursive search?) I've alsoo written a class in project 2 that needs to be accessed from project 1 alsoo. I have set my include paths correctly. It links in project2 correctly but in project1 it receives errors while linking. If i put the files in directory of project 2, the class compiles without a problem. How is this possible?

        A 1 Reply Last reply
        0
        • J JensB

          First of all, thanks for the reply. I had included the location of 'Myheader.h' file in the first project like 'C:\vss\'. I knew it was going to be in a subdirectory of 'C:\vss'. I've now replaced it with the exact directory and now the compiler finds the file!! Really strange. (No recursive search?) I've alsoo written a class in project 2 that needs to be accessed from project 1 alsoo. I have set my include paths correctly. It links in project2 correctly but in project1 it receives errors while linking. If i put the files in directory of project 2, the class compiles without a problem. How is this possible?

          A Offline
          A Offline
          Antony M Kancidrowski
          wrote on last edited by
          #4

          Are you talking about a header file and a lib ? If so you need to ensure the compiler knows where the .lib file is also. It isn't sufficient to just state where the header is. Ant. I'm hard, yet soft.
          I'm coloured, yet clear.
          I'm fruity and sweet.
          I'm jelly, what am I? Muse on it further, I shall return!
          - David Williams (Little Britain)

          J 1 Reply Last reply
          0
          • A Antony M Kancidrowski

            Are you talking about a header file and a lib ? If so you need to ensure the compiler knows where the .lib file is also. It isn't sufficient to just state where the header is. Ant. I'm hard, yet soft.
            I'm coloured, yet clear.
            I'm fruity and sweet.
            I'm jelly, what am I? Muse on it further, I shall return!
            - David Williams (Little Britain)

            J Offline
            J Offline
            JensB
            wrote on last edited by
            #5

            Antony, I meant a class having a .h (header) and a .cpp .

            A 1 Reply Last reply
            0
            • J JensB

              Antony, I meant a class having a .h (header) and a .cpp .

              A Offline
              A Offline
              Antony M Kancidrowski
              wrote on last edited by
              #6

              What is the link error message you are receiving? Ant. I'm hard, yet soft.
              I'm coloured, yet clear.
              I'm fruity and sweet.
              I'm jelly, what am I? Muse on it further, I shall return!
              - David Williams (Little Britain)

              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