Linker Error: Cannot open input file 'd3dx9.lib' - visual-studio

This is a very simple question but I have been searching for a while now and have no luck. Im supposed to add it to the linker I beleive? Which is Project Properties > Linker > Input > Additional Dependencies. Im just confused on exactly what to do. Thank you.

The simplest solution is to add the Microsoft.DXSDK.D3DX NuGet package to your project and not use the legacy DirectX SDK at all. This puts the headers d3dx9*.h, d3dx10*.h, and d3dx11*.h into your include path. It also adds d3dx9.lib, d3dx10.lib, and d3dx11.lib to your link settings, and provides the required runtime DLLs 'side-by-side'. See this blog post.
Otherwise, to integrate the legacy DirectX SDK requires some special include/lib path ordering in VC++ Directories, and you'll have a number of other quirks to contend with. See Microsoft Docs for the details.
Of course, the real question is "Why are you using legacy Direct3D 9 in the first place instead of Direct3D 11?". For Direct3D 11 or Direct3D 12, you should avoid the legacy DirectX SDK and D3DX9/D3DX10/D3DX11 entirely. See Living without D3DX.

Related

Visual Studio Not Finding 'vulkan-1.lib'

I read this tutorial to try to set up Vulkan in Visual Studio. I got to the very end, compiled, and got this:
A few more screenshots:
I'm using version 1.1.114.0 while the tutorial is using 1.1.77.0, which may be at the root of the issue. However, I have not been able to find another tutorial showing how to set Vulkan up like this. How do I get Vulkan to work in Visual Studio?
I believe you must have missed a step in the tutorial. Specifically, look for the text
Next, open the editor for library directories under Linker -> General
in the linked tutorial page.
In the linker Input tab, either use a complete path to the Vulkan library (for example C:\VulkanSDK\1.1.101.0\Lib\vulkan-1.lib) or in the General tab, add the location of the library (for example C:\VulkanSDK\1.1.101.0\Lib to the Additional Library Directories entry).
If you can express the values in terms of an environment variable, then you'd want to use either VULKAN_SDK or VK_SDK_PATH, which in the above examples would resolve to C:\VulkanSDK\1.1.101.0. That way when you update your Vulkan SDK you don't need to update your project files, and they'll work on other machines that might have different versions installed.
In the long run I'd recommend switching to CMake for project generation, rather than maintaining Visual Studio project files directly. With CMake, adding a Vulkan dependency to your application is as easy as doing this:
find_package(Vulkan REQUIRED)
target_link_libraries(MyApp Vulkan::Vulkan)
You can find existing CMake-based Vulkan examples here or here.

Searching for a maintained binary diff/patch tool or library

I am looking for an executable (or a library that I might embed in C# or via Managed C++ into the C# project) to create binary diff files for two folders and their contents and a patch tool to apply those patch files as well targeting Windows.
This SO post refers to various tools such as bsdiff/bspatch which is highly dated. The 3rd party executable that is available here does not work when trying it out though. Another variant that is not compatible with the original is the following. Unfortunately it relies on bzlib and certain Linux headers and I wasn't really able to set it up accordingly under Visual Studio.
Anyways, all tools and posts are about 8-10 years old and I'd like to know which tools and libraries are currently maintained that I might take a look at.
I have been experimenting with Octodiff and I am impressed and will most likely be using it in production.

Recommended Cross-Platform (Windows and Android) Project Set Up using OpenTK

I am starting to develop a scientific software that I hope I will be able to run on multiple platforms. My plan is to use OpenTK for the rendering of the scientific models and plots. As of the moment I have a prototype that runs on Windows using OpenTK 1.1 libraries from http://www.opentk.com/ (a simpler version just with OpenTK and a more complicated one with OpenTK + WindwosForms). I am trying to port that prototype to Android.
It seems that the syntax using by the Xamarin.Android OpenTK library is nearly identical to the one that I am currently using for Windows (with the only difference that OpenGL -> OpenGL ES and GameWindow -> AndroidGameView) so the porting shouldn't be an issue. However, I was hoping that I could avoid a copy-paste method and get a more permanent solution having a shared OpenTK code between the Windows and the Android version.
I have read trough the Xamarin documentation about the shared vs PCL methods for cross-platform development. However, I still struggle to figure out how to set-up a Visual Studio solution with an Android and Windows project and a shared code that will include OpenTK. Is that even possible and can someone give me an example of how to do it? I did explore an example I found for rendering a rotating cube using OpenTK for a shared Android/iOS project (http://developer.xamarin.com/content/TexturedCubeES30/) but in my case I need to use a different OpenTK library for the Windows and for the Android project.
I also found this Do the Android and iOS versions of OpenTK have the same API? discussion. It is very similar to what I would like to do but in my case I am trying to setup a project for Windows and Android (for now).
Can I use only one OpenTK library (which one?) that is being called from both the Android and the Windows project and what will be the right way to set-up both projects so they share the same OpenTK code. This is the first time I am dealing with writing a cross-platform code so I am a bit lost.
Edit: I was able to get a prototype running using Shared Xamarin project and compiler flags as proposed below. Code was indeed not very pretty at places but I got over 70% code re-usability between the two platforms so it was worth the effort. This is how I used the compiler flags in case someone is looking for the same thing (credit to SKall from the Xamarin forums):
#if __ANDROID__
using OpenTK.Graphics.ES11;
#else
using OpenTK.Graphics.OpenGL;
#endif
I used the #if syntax similarly where there were small differences between the syntax of the routines.
It does not seem like OpenTK has its logic inside of a PCL in the first place, so your plans on putting it there are going to get hard to achieve.
However, if you split out your code, such that most of it is contained in classes, which are not highly dependent on the underlying platform, you will be able to create a Class Library Project for each platform and link your files between the platform specific projects. Inside of the classes it contains you will use #if definitions to choose whether to use AndroidGameView or GameWindow and the same goes for other platform specific types. It will make the code ugly, but this is the alternative to PCL.
You could try to see how much of the OpenTK code compiles inside of a PCL and inject the platform specific stuff at runtime, but it will require considerably more work from you. However, it will make the code a lot more cleaner to look at.
To ease the file linking, you could make one of those Shared Projects and chuck in all of the logic in there.
Some more info about code sharing here: http://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/
Dependency injection: https://en.wikipedia.org/wiki/Dependency_injection

Directx changes

i have a problem with win8 and directx library. i have directx jun 2010 i added its d3dx11.lib and .h files but it doesnt work and says library not found. i found hte link bellow that says you can work with win8 sdk instead of directx libraries and d3dx.... libraries are not supported anymore.
http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275%28v=vs.85%29.aspx
i found in vs2012 there is a project that builds directx proggram but when i made a project with it it wasnt like any directx code ive seen before its more like xna
what these really mean? how should i work with these changes? its better to return to win 7 and previous libraries or work with these new tools. thanks for helping
"Where is the DirectX SDK?" explains that well. Probably you will want to read it one more time.
D3DX
D3DX and D3D is not the same. D3DX is just a helper library. Microsoft not recommends to use D3DX anymore and stripped it from SDK. So now:
For new code: "Living without D3DX" (alternative link) explains what to use instead in your new code. And here are some D3DX replacement stuff.
For old code: if you just want to build old code that uses D3DX (tutorial samples, for example), you just need to install DirectX SDK and add include/lib paths to your project, as if it was any other library. Mixing Windows SDK and DirectX SDK is not recommended and can lead to errors, so don't use it in new code. Also read here.
Probably, you will be interested to read this and that answer also.
P.S. As always, if linker says, "Library not found", double check, that you've added library path to project options and that library file exists at that folder.
Happy coding!

How can I build a targetting pack for Portable Class Libraries?

I'm building some code with these portable class libraries at present.
I'm looking to target full .Net, WinRT Metro, Windows Phone, ... and then MonoTouch and MonoDroid. My experiments today show this can work - http://slodge.blogspot.co.uk/2012/04/experiments-with-portable-class.html
However, I have hit a fairly significant problem - MonoTouch and MonoDroid currently support these libraries in that you can consume PCLs as binary assemblies, but they don't allow linking between project files
e.g. I can reference MyLib.dll from a MonoDroid project, but I can't reference MyLib.csproj.
This is a problem as it means automated (resharper) refactoring doesn't work - and I seem to rely on this for most of my work!
I've seen that Microsoft publish targetting packs that allow you to extend class libraries, but I've not worked out where these install to or what they modify.
Here's the current Microsoft list: http://msdn.microsoft.com/en-us/hh487282.aspx
Does anyone have any knowledge about what these packs contain or how someone might make their own pack? If they're not too overly complex, then I would like to have a go at producing one for MonoTouch and/or MonoDroid.
This has come up a few times recently, so I wrote a blog post that should do what you want:
http://jpobst.blogspot.com/2012/04/mono-for-android-portable-libraries-in.html
Please let me know if have any issues!

Resources