Including an external library in Visual Studio 2010 project - visual-studio-2010

I'm new to visual studio and can't seem to find an answer to this anywhere.
I'm working on a project in VC++ with VS2010. I have another project that builds into a .lib file set up as a reference, but can't figure out how to actually include the headers. Google has proved useless. Please help!

Generally this is done by adding the directory where the include files live to the project's "Additional Include Directories" property (in the "C/C++ | General" property page).
Note that the location can be a relative path if the different projects will always be at the same file system level relative to one another, or they can use VS macros or environment variables.

Related

Visual Studio 2017 How to add missing dll to C++ project?

I have a Visual Studio 2017 C++ project which depends on ffmpeg libraries. As of now it crashes at run time because of the missing dependency avformat-58.dll. I've tried adding this file into the project by dragging it into my project but that does not suffice. I tried looking at the Add Reference screen but it is empty. What can I do?
On the advice of #HansPassant I added the dll(s) to the project as existing external files. I think there should now be an option somewhere to "Copy to output directory" but I'm not seeing it. Here is what I see when I open property pages of one of the dlls.
#sellotape Here is a screenshot of the window when I just single click.
According to this documentation https://learn.microsoft.com/en-us/windows/desktop/Dlls/dynamic-link-library-search-order I can copy the necessary dlls to any directory in the PATH environment variable. There were many dlls already in C:/Windows/System32 already so I just put the ffmpeg dlls there as well and the executable runs.

VS2010 VC++ Setup Project misses language dll

I have created a Setup Project in VS2010 for my VC++ project and I have it generating a setup file and it includes Primary Output, Content Files, Documentation files and Resource Sattelite DLLs from my VC++ project. My VC++ project is multilanguage and hence includes language DLL files in subdirectories. My issue is that the Setup Project does not include these language DLLs (nor their directories into which they must be placed).
I would have thought that these DLLs were included in the Project Output but they are not. :-/
I know I could add them manually by referencing the files directly, but that means including a absolute reference which I would rather not do. Also, a fixed reference means Release/Debug versions of the file are not handled (only one of them is use regardless of project setting).
Suggestions?
Edit: I have now tried Setup Project, InstallShield LE and WiX. None of them include the localization dll's into the setup project (only managed a working setup with Setup Project, but could see that the other installers did not include the required dll). I can't even fint any reference to this being a know bug and I have really tried hard to find a solution to this.
Found it over there:
C# Creating a setup for multi-language
It worked. I hope it is what you were searching for.

DirectX SDK integration with VS 2010

I'm not sure if anyone has noticed but there seems to be a conflict with the DirectX SDK and VS2010's Windows SDK. If you look inside the folder under the directory
C:\Program Files (x86)\Microsoft
SDKs\Windows\v7.0A\Include
You will see it contains the old headers for DirectX 11. The above directory is by default included to each VS 2010 project file and is required in order for VS 2010 to be able to compile correctly.
The same is true for .lib files for DirectX.
Now here lies the problem, to include the Directx SDK to your project in VS2010 you add the directories via the project property sheet. This automatically means you are including both the old headers and libs for DirectX as well as the new ones... :(
If you think you're building with the latest DirectX libs and header files you may very well be mistaken as the compiler could be using the unintended files.
How can I get around this problem as I can't seem to compile anything without keeping the default project settings ?
Also bare in mind I am using C++ and VS2010 Ultimate from MSDNAA.
Short answer: It probably doesn't matter.
Updated DXSDK installation won't update the system DLLs that ship with windows. It doesn't matter if you are including/linking with the DXSDK directory or the v7.0A directory. When the app runs, it loads the same DLLs either way. (Notable exception: the D3DX_xx.dll for helper functions - as those aren't OS components, they ship with the SDK and are meant for inclusion in the app setup package). The header files that ship with DXSDK should be nearly identical to what's in the v7.0a directory.
And if I'm not mistaken, include and lib directories specified in the Project Settings dialog for your app take predence BEFORE default SDK dirs. So updating your Project Settings dialog should be ok.
But if you really want to be sure... Instead of adding the DXSDK header/libs for each project, make them default search directories for all projects.
From the top-level menu for Visual Studio: Select Tools->Options.
From the left-nav menu on the Options dialog select "Project & Solutions", and "VC++ Directories" underneath that.
Then on the dropdown in the top right for "Show Directories for", select "Include Files".
Makes sure your $(DXSDK) include directory comes before the $(WindowsSdkDir) entry. If it's not already there, add it.
Repeat this for the "Library Files" option under the "Show Directories for" menu option.

Using Boost and Visual Studio

I did see some similar questions about this - but I couldn't piece together what I needed.
I'm using boost in a project in Visual Studio 9, and I'm unable to get it to recognize all the header files that I'm trying to include. I'd installed Boost using the Windows installer that also places the binaries on my machine.
In Visual Studio, I modified the Project->Properties->Linker->Additional Libarary Dependencies to include the folder "mypath\boost_1.44\lib", which contains the binaries - but I still can't get VS to recognize my Boost header files. Please help!
Cheers.
edited to clarify some text
You need to modify the project properties to add header locations for the boost headers as well. If you want a global setting, this is how you do it:
Tool->Options->Projects and Settings->VC++ Directories. Then on the right hand side, Open the dropbox labeled "Show Directories For" and pick "Include Files".
Add a new line for your boost header path.
This is a screenshot from VS2008 - it is similar in VS2010 and VS2005.
Additionally, you can also set these directories on a per-project basis by modifying each project's specific properties.

How to add satellite assemblies to a project in Visual Studio

I'm working in a project which references assemblies from a third company. These assemblies have satellite assemblies that I'm copying with a post-build event to the bin folder.
Is There a way to include those third party satellite assemblies into the project so I have not to care with the post-build events and maintaining the files?
Thanks in advance.
MORE INFORMATION: As the references have only resources they are not added as project references, actually I'm just copying them to the // folder. As each localized reference has the same name I would only be able to add it one time to the project's references.
It is automatic in the C# IDE. Setting Copy Local = True on the assembly reference ensures that the satellite assemblies get copied as well. In the C++ IDE it is a setting: Framework + References, Build properties category, "Copy Local Satellite Assemblies".
There's not enough info in your question to narrow down which IDE you use or why it wouldn't work for you. Maybe that 3rd party is doing something non-standard. Give them a call.
I was researching a related problem and stumbled on this thread. Please note that referencing the satellite assemblies directly (via the 'add reference' dialog) is not the way to incorporate them into your application. In stead just make sure they are located in a folder hierarchy as suggested above (relative to the original location of the binary file they contain resources for).
The only file you add a reference to explicitly is the library itself. Do remember to set 'copy local' to true in the property window of the reference. The runtime will then make sure to pull resources from the file whose directory matches the system locale.
In the references, right click and select properties on your reference to the third party assembly.
Ensure that "copy local" is true.
If this is true, then it should copy the satellite assemblies, as this is the behavior I've experienced in Visual Studio.

Resources