Avoiding Millions of Additional Dependencies

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2009
Posts: 5
Reputation: tnind is an unknown quantity at this point 
Solved Threads: 1
tnind tnind is offline Offline
Newbie Poster

Avoiding Millions of Additional Dependencies

 
0
  #1
Aug 11th, 2009
Hi, I am pretty new to C++ but have lots of experience in java/c# and know the basics (classes/structures/pointers etc) but am having some problems linking to external source libraries.

I am trying to use something called the openframeworks which I have downloaded and I need to include "\libs\openFrameWorks\ofMain.h" but when I do this it complains about all the includes that that file links to (which are in subdirectories of openFrameWorks folder) and I have to add a dependency to every subdirectory in the library.

Is there a better way of doing this, I understand that you cant automatically add all subdirectories but my Additonal Dependencies list is getting stupidly long.

Thanks in advance, sorry for being noobish
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 147
Reputation: Laiq Ahmed will become famous soon enough Laiq Ahmed will become famous soon enough 
Solved Threads: 20
Laiq Ahmed Laiq Ahmed is offline Offline
Junior Poster

Re: Avoiding Millions of Additional Dependencies

 
0
  #2
Aug 11th, 2009
it depends on the compiler rather than C++, you should see the compiler reference manual.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 302
Reputation: JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough JasonHippy is a jewel in the rough 
Solved Threads: 52
JasonHippy's Avatar
JasonHippy JasonHippy is offline Offline
Posting Whiz

Re: Avoiding Millions of Additional Dependencies

 
0
  #3
Aug 11th, 2009
I'm not sure which compiler you're using, but usually you'd register any 3rd party libraries with your compiler.

e.g. In Visual Studio 2003 you'd:
In the Solution Explorer, right click on your project and select 'properties'.
In the property pages, select the 'C/C++->General' item in the tree.
Now select the 'Additional Include Directories' in the form and click on the '...' button. This will bring up a dialog which will allow you to add the path to the include folder of your library.
To do this, click on a blank line in the list (or add one using the folder icon and then select it). Next select the '...' button and use the popup dialog to navigate your way to the libraries include folder.

So that's the first part, the headers for your library are registered with the IDE. Next you need to ensure that the linker knows where to find the precompiled library files (usually found in the lib folder).

To do this, select 'Linker->General' in the tree and select the 'Additional Library Directories' item in the form and click on the '...' button that appears to bring up the 'additional library directories' dialog. As with the 'additional header directories' dialog, select a blank line (or add one using the folder icon and then select it) and use the '...' button to navigate to the lib directory for your library.
That done, click OK on all of the open dialogs and that's it! Your library is registered with the IDE.

Now in your project you should be able to use the library without having to add loads and loads of includes into your code. You'll only need to include the main header/headers for the library instead of every single one of them. And you'll be able to declare them like:
  1. #include<"yourlibraryheader.h">
Instead of:
  1. #include<"C:\path\to\library\yourlibraryheader.h">
Which I assume is more or less how you're currently using them!

The instructions I've included are for VS2003, but the steps should be similar for 2005 and 2008.

If you're using any other IDE, you'll have to refer to the manual for your compiler. Most compilers nowadays have the ability to register additional headers/libraries in this way.

Hope this has helped,
Cheers for now,
Jas.
Last edited by JasonHippy; Aug 11th, 2009 at 8:05 am. Reason: smelling pistakes and pytos! heh heh!
There are 10 types of people in this world.....
Those who understand binary .....
And those who don't!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC