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. Linking to another project [SOLVED]

Linking to another project [SOLVED]

Scheduled Pinned Locked Moved C / C++ / MFC
visual-studiohelpquestiondiscussion
4 Posts 2 Posters 1 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.
  • C Offline
    C Offline
    Christian Flutcher
    wrote on last edited by
    #1

    My directory structure is like the following

    Solution Directory
    --Project1
    --Project2

    From Project2, I have to use classes written in Project1. I have included the header files like the below in Project2

    #include "../Project1/SomeHeader.h"

    I can see the classes in intellisense but the problem occured with linker. It is saying about unresolved external symbols. I am looking for a method to link the file to Project1. Any thoughts? EDIT: I solved it by adding the project dependencies. Right click on the project -> Project dependencies -> Check the Project1, save and build. :) I'd like to hear from you guys that is this the right approach to solve the above described problem? Thanks

    modified on Monday, December 29, 2008 11:25 PM

    C 1 Reply Last reply
    0
    • C Christian Flutcher

      My directory structure is like the following

      Solution Directory
      --Project1
      --Project2

      From Project2, I have to use classes written in Project1. I have included the header files like the below in Project2

      #include "../Project1/SomeHeader.h"

      I can see the classes in intellisense but the problem occured with linker. It is saying about unresolved external symbols. I am looking for a method to link the file to Project1. Any thoughts? EDIT: I solved it by adding the project dependencies. Right click on the project -> Project dependencies -> Check the Project1, save and build. :) I'd like to hear from you guys that is this the right approach to solve the above described problem? Thanks

      modified on Monday, December 29, 2008 11:25 PM

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

      What kind of projects are Project1 and Project2 ? Is Project1 a library ? If yes, then your approach is the correct one (of course you need to add the library in the project settings of Project2).

      Cédric Moonen Software developer
      Charting control [v1.5] OpenGL game tutorial in C++

      C 1 Reply Last reply
      0
      • C Cedric Moonen

        What kind of projects are Project1 and Project2 ? Is Project1 a library ? If yes, then your approach is the correct one (of course you need to add the library in the project settings of Project2).

        Cédric Moonen Software developer
        Charting control [v1.5] OpenGL game tutorial in C++

        C Offline
        C Offline
        Christian Flutcher
        wrote on last edited by
        #3

        Cedric Moonen wrote:

        Is Project1 a library

        Yes. Project1 is a library.

        Cedric Moonen wrote:

        of course you need to add the library in the project settings of Project2

        Did you mean the linker settings? If yes, I haven't done that but the build and linking was successful. Am I missing something?

        C 1 Reply Last reply
        0
        • C Christian Flutcher

          Cedric Moonen wrote:

          Is Project1 a library

          Yes. Project1 is a library.

          Cedric Moonen wrote:

          of course you need to add the library in the project settings of Project2

          Did you mean the linker settings? If yes, I haven't done that but the build and linking was successful. Am I missing something?

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

          Christian Flutcher wrote:

          If yes, I haven't done that but the build and linking was successful

          That's a bit strange... Normally you should have added it in the project properties: "Linker" category" -> "Input" and you should add it in the "Additional Dependencies". EDIT: or another way to do it is to make use of a #pragma. That's what you did maybe ? In such case, you don't need to change the properties of project 2.

          Cédric Moonen Software developer
          Charting control [v1.5] OpenGL game tutorial in C++

          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