943,775 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 710
  • C++ RSS
Aug 11th, 2009
0

Avoiding Millions of Additional Dependencies

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
tnind is offline Offline
5 posts
since Apr 2009
Aug 11th, 2009
0

Re: Avoiding Millions of Additional Dependencies

it depends on the compiler rather than C++, you should see the compiler reference manual.
Reputation Points: 113
Solved Threads: 20
Junior Poster
Laiq Ahmed is offline Offline
147 posts
since Jun 2006
Aug 11th, 2009
0

Re: Avoiding Millions of Additional Dependencies

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:
C++ Syntax (Toggle Plain Text)
  1. #include<"yourlibraryheader.h">
Instead of:
C++ Syntax (Toggle Plain Text)
  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!
Reputation Points: 590
Solved Threads: 123
Practically a Master Poster
JasonHippy is offline Offline
672 posts
since Jan 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: need help to store coordinates in vector array
Next Thread in C++ Forum Timeline: cmd from cpp





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC