LIBPATH option of referenced library project - visual-studio-2010

I have a Static library project that depends on an external library. I've added the folder of the external library to the 'Additional Library Directories' setting of the Static library project. When I then create a project and add a reference to this Static library project it still fails to find the external lib file at link time. Only when I add the folder of the external lib to the 'Additional Library Directories' setting of the application project instead it finds the lib file.
Is there a way of adding something to /LIBPATH automatically so that each application project that references the Static library project automatically finds the external lib file? I don't really want to specify the folder in the general 'Library Directories' folder. I also can't use a '#pragma comment(linker, "/LIBPATH...")' instruction.

Related

does not find the namespace Telerik.Sitefinity.Cloud.WindowsAzure in the class AzureWebRole.cs

but when he builds the solution its seems of all the refrences are missing and does not compile because it does not find the namespace Telerik.Sitefinity.Cloud.WindowsAzure in the class AzureWebRole.cs
The sitefinity project creator puts all of the required dlls in the bin folder and adds the references in the project to them in this location. In my opinion, this is not a good strategy as the bin folder should be generated from external sources, but that's how it goes at the moment.
Your options as I see them are :
Copy the dlls to a shared folder and change the references' HintPaths to this location.
Check the bin folder into source control (gak!)
Change the project to use the Nuget package strategy for the sitefinity references.

Class library lib and dll files

To use class library I must have header file and lib file that I suppose contains compiled library code. So, why and when I need dll file? I have breath understanding that in case of dynamic linking I must use dll and in case of static linking there is no need to use dll.
You can have a library project or a DLL project. A DLL is good if it will be used by multiple exes. A lib is good if you want it to become part of an exe.
DLL projects generate both a DLL file and a lib file. The import lib file is very small and just contains a jump table so the exe can be compiled.
When your library is dynamic library i.e, .dll, .lib file have exports table. .h header file have function prototype.
Export table is table of all exported functions from dll.

Using Dylibs Inside App Bundle

I am trying to compile an app that uses multiple libraries using Xcode. To do so, I created a script that copies all of my .dylibs from a location on my computer to the Frameworks folder inside my app bundle.
After adding the necessary linker flags and header search paths, I must now add my library search paths.
Since I have copied all the libraries inside my Frameworks folder of my app bundle, I have deduced that I must add $(FRAMEWORKS_FOLDER_PATH) to the library search paths setting. Adding this fails, because the linker can not find that directory.
I am guessing that the Frameworks folder isn't created until after searching the library search paths setting. If so, how am I supposed to use the libraries that I have copied inside my app bundle?
Placing the .dylib files in the Frameworks folder is something you do so that the application can find them when it runs.. dylib files are dynamically linked, so the application loads them at run time.
Setting Xcode up to link to the .dylibs at compile time should just be a matter of dragging the .dylib from the Finder into your Xcode project. I've shown this with a simple example project that uses libxar.dylib in the attached screenshot.

Building source from external directories in Xcode 4

I have a directory of source files (.h and .m) that are shared between multiple projects. I'm not building them as a static library; instead, I just include the source in each project.
Previously, I was copying the source into each project independently, but now, I'd like to move to having a single directory that has all of those shared files it, and include a folder reference to them in each XCode project that uses them.
Including them as a folder reference (blue folder) is no problem, and I can add the path to the header includes so that the files in the project can see them. But they're not being built, and thus I'm getting link errors.
How do I get Xcode to build the source in the external directory?
folder references don't work like that in xcode.
this is exactly what an external target (e.g. static library) is for... seems strange that you would choose to duplicate (a portion of) the maintenance for every project. with a library, you can also reduce the build and indexing times (assuming the build settings match some of the time).
if you insist that a static library is a bad idea... you can approximate what you want by creating a custom build script phase for your target (you will need to configure a script, rather than passing the xcode folder reference as input).

including dll's not referenced in bin directory

I have a dependency folder that I use for dll's in my web application. Some are referenced in the web application, others aren't. However for the application to run I need to have all the dll's in the bin directory of the web application. But I dont want to reference them in the web app. Is there a work around for this? I was considering the post build event to copy in the dll's required from dependencies to bin directory.
If the assemblies are implicitly referenced (required by assemblies you have referenced) they should be automatically copied to the output path. If there are assemblies which you are dynamically loading with reflection like form example some plugins you will need to copy them manually to the bin folder. A post-buid event seems like a good approach.
You can use PostBuild event as you mentioned or edit the project file to include MSBuild Copy Task.
Check: http://msdn.microsoft.com/en-us/library/3e54c37h.aspx

Resources