Thread: How do I make one project in VS depend on another

  1. #1
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901

    How do I make one project in VS depend on another

    I made two projects, one a onsole app, and on a C++ shared library project.

    I set the project dependencies on the console app to the shared library, so when it builds the shared library is built. I added the name of the .dll binary to the "additional dependencies in the console app. But in the .cpp file containing main, I reference the .h file for the library but when I try to compile it can't locate the file. How do I get it to load the file.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Did you also specify the path to the library header file?

    Three separate fields may need to be filled in
    - path to header file
    - path to library file
    - name of library file
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    -in my dll project I set the output path to a distrib folder in the root, along with the obj. and other files.
    -in my console project I set the additional folders to that distrib folder, and also to the dll project path to look up the header.
    -In the console project I added to the aditional dependencies the name of the dll that the dll project outputs.

    When I compile I get an "fatal error LNK1104: cannot open file 'Direct3DUtilities.dll'"

    Even though the paths are set.
    Last edited by indigo0086; 05-25-2009 at 10:05 AM.

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Erm, does that mean the file is open / in use?
    Because the linker will not attempt to open the .dll file when linking with it (in your console project). Only when it's built.
    And for the record, you only need to set a dependency to the project in the settings (and possible an additional include path to the header). Nothing else should have to be set.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #5
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I set the path correctly it's just not finding the dll. I mean does the project only need the .dll file or some other ones? does the manifest/obj file and other stuff need to be put in that folder.

  6. #6
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    You need to have the .dll in the same folder as your application's .exe is/are ...
    If you're using MS VS C++ then the only thing I had to do was, make the projects depend on each other correctly, set the linker to search for libraries at the folder where your libraries are ( The compiler reads the object libraries and export libraries ) then link the compiler to the folder(s) where your headers are stored...
    Currently research OpenGL

  7. #7
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I've done all that, it's just throwing this fatal error when I try to compile. I set the dependency to the project, so when I build the console app it builds the dependant project, I then set the dll in my linker additional dependencies, then set the folder for the header files. It's just always saying it can't open the dll file.

  8. #8
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    When does the error occur? When you compile or when you try to run it?
    And if it's a compile error, for which project? The dll or the other?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    When I try to compile the Console project that depends on the dll project. I can compile the dll project fine, it dumps the files in the propper directory, I can see them. When I try to compile the console project it throws an error.

  10. #10
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Here's a visual

  11. #11
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    as I said earlier, the compiler reads the .lib files, not the .dll, that's read at run time...
    Currently research OpenGL

  12. #12
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    my project doesn't output the lib files

  13. #13
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    So I narrowed the issue down to me having to use this stupid DLL Export bulls*** to create a .lib file.

    Is there an alternate way to create a .lib file so I can use standard C++ again?

    Even though I do the exporting and including the .lib file that is generated it's still complaining about not being able to open it.
    Last edited by indigo0086; 05-25-2009 at 02:17 PM.

  14. #14
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    In VS Express 2008, have both projects in the same solution, then right click the dependant project and select Project Dependencies, then check the projects it is dependant on.

  15. #15
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I've done that, my visual studio must be broken.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. trying to make a KenGen ( for a game tool )
    By lonewolfy in forum C# Programming
    Replies: 4
    Last Post: 03-28-2007, 08:23 AM
  2. Commerical MMORPG Developer Opp
    By Th3Guy in forum Projects and Job Recruitment
    Replies: 19
    Last Post: 01-22-2007, 11:28 AM
  3. Can't make a simple Project work
    By kantze in forum C++ Programming
    Replies: 5
    Last Post: 01-22-2007, 03:21 AM
  4. "Cannot make pipe"
    By crepincdotcom in forum C Programming
    Replies: 5
    Last Post: 08-16-2004, 12:43 PM
  5. Operating System Project
    By Pete in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 07-15-2004, 09:33 AM