How do I make one project in VS depend on another

This is a discussion on How do I make one project in VS depend on another within the Tech Board forums, part of the Community Boards category; I made two projects, one a onsole app, and on a C++ shared library project. I set the project dependencies ...

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,333
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  4. #4
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,165
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,165
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  10. #10
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    Here's a visual
    Attached Images Attached Images  
    Here to Deceive, Inveigle, Obfuscate Since 1945

  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
    Here to Deceive, Inveigle, Obfuscate Since 1945

  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.
    Here to Deceive, Inveigle, Obfuscate Since 1945

  14. #14
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    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.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  15. #15
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    I've done that, my visual studio must be broken.
    Here to Deceive, Inveigle, Obfuscate Since 1945

Page 1 of 2 12 LastLast
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, 10:28 AM
  3. Can't make a simple Project work
    By kantze in forum C++ Programming
    Replies: 5
    Last Post: 01-22-2007, 02: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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21