C Board  

Go Back   C Board > Community Boards > Tech Board

Reply
 
LinkBack Thread Tools Display Modes
Old 05-25-2009, 09:07 AM   #1
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
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
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 09:57 AM   #2
and the hat of Jobseeking
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 21,710
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.

Salem is offline   Reply With Quote
Old 05-25-2009, 10:01 AM   #3
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
-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.
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945

Last edited by indigo0086; 05-25-2009 at 10:05 AM.
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 10:46 AM   #4
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
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.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 05-25-2009, 11:12 AM   #5
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
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
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 12:51 PM   #6
Hail to the king, baby.
 
Akkernight's Avatar
 
Join Date: Oct 2008
Location: Faroe Islands
Posts: 718
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
Akkernight is offline   Reply With Quote
Old 05-25-2009, 12:57 PM   #7
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
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
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 01:06 PM   #8
Mysterious C++ User
 
Elysia's Avatar
 
Join Date: Oct 2007
Posts: 14,785
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?
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 05-25-2009, 01:07 PM   #9
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
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
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 01:18 PM   #10
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
Here's a visual
Attached Images
 
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 01:20 PM   #11
Hail to the king, baby.
 
Akkernight's Avatar
 
Join Date: Oct 2008
Location: Faroe Islands
Posts: 718
as I said earlier, the compiler reads the .lib files, not the .dll, that's read at run time...
__________________
Currently research OpenGL
Akkernight is offline   Reply With Quote
Old 05-25-2009, 01:27 PM   #12
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
my project doesn't output the lib files
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 02:11 PM   #13
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
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.
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945

Last edited by indigo0086; 05-25-2009 at 02:17 PM.
indigo0086 is offline   Reply With Quote
Old 05-25-2009, 03:35 PM   #14
Malum in se
 
abachler's Avatar
 
Join Date: Apr 2007
Posts: 3,188
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.
abachler is offline   Reply With Quote
Old 05-25-2009, 03:37 PM   #15
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
I've done that, my visual studio must be broken.
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945
indigo0086 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

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


All times are GMT -6. The time now is 02:13 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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