Cannot open include file "d3dx9.h" - visual-studio-2010

Edit: Of course, immediately after working on it for an hour then posting here, I found the stupid mistake...
I'm getting compiler errors when trying to #include <d3dx9.h> in a project. I'm receiving "fatal error C1083: Cannot open include file: 'd3dx9.h': No such file or directory".
I do have the DirectX SDK installed (I also just tried reinstalling it to no avail).
In the Project Properties:
VC++ Directories are set to "$(DXSDK_DIR)Include;$(IncludePath)" and "$(DXSDK_DIR)Lib\x86;$(LibraryPath)" for Include and Library directories respectively for all configurations—and the environment variable %DXSDK_DIR% points to C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\ as expected.
C/C++ > General settings has $(DXSDK_DIR)include listed in the Additional Include Directories
Linker > Input > Additional Dependencies has d3dx9d.lib included for Debug and d3dx9.lib included for Release configuration.
I am able to successfully compile and run tutorial projects from the DirectX Sample Browser.
Visual Studio's Intellisense/autocomplete will find d3dx9.h and suggest type and function names that are within the file (and not included through anything else I'm #includeing) so it seems that Intellisense can find it.
Any suggestions on what I'm forgetting or what else to try?
Thanks

you forgot one thing:
Go to VC++ Directories -> Library Directories
add $(DXSDK_DIR)LIB\x86
apply.
Done. Hope this helps

You should make sure you have ALL paths sorounded by quotes (").
Instead of $(DXSDK_DIR)include you should have "$(DXSDK_DIR)include"

I didn't realize that one of the other projects in the solution was #includeing a file that was #includeing a file that was #includeing d3dx9.h and I hadn't added those paths to that project.
/facepalm

Find the file on your computer, and add it's folder to the properties of your project.
Assuming you have visual studio: Properties/C/C++/General/Additional Include Libraries.

I tried all of these suggestions and none worked.
Turns out the $(DXSDK_DIR) variable doesn't work if you install DirectX while Visual Studio is still running. The solution for me was to restart Visual Studio (+ adding the paths in the solutions listed above, of course).

Related

Setting up Windows SDK in VS2012 Windows7

I'm trying to set up Windows SDK for DirectX11 but having a bit of trouble.
I'm on Windows7 with Visual Studio 2012.
The error I'm getting is:
1>TRACKER : error TRK0005: Failed to locate: "fxc.exe". The system cannot find the file specified.
So I assume it isn't locating the SDK correctly (I think it's an HLSL error).
So far in my project directories I have:
Include directories: $(WindowsSDK_IncludePath)
Library directories: $(WindowsSDK_LibraryPath_x86)
Library WinRT directories: $(WindowsSDK_MetadataPath)
I've checked where these macros go, and they go to the right place:
C:\Program Files(x86)\Windows Kits\8.0\etc...
which is where I installed it, however the error I wrote above is still showing up.
I'm stumped as to what to do next, could anybody help?
It is located in C:\Program Files(x86)\Windows Kits\8.0\bin\x86\fxc.exe, first check if it is there.
The VS setting that matters is Project + Properties, VC++ Directories, Executable Directories. It normally includes $(WindowsSDK_ExecutablePath_x86) so should never have a problem locating the file.

OpenCV error in Visual Studio 2010: fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'

I have installed OpenCV 2.4.3 on Windows 7-64 bit. I am using Visual Studio 2010. OpenCV is installed in c:/opencv. I have added the environmental variables and all the necessary library dependecies. But, I always get this error :
fatal error LNK1104: cannot open file 'opencv_calib3d243.obj'.
The settings for VS2010 linker options is like below:
Additional Library Directories: C:\opencv\build\x64\vc10\lib
Additional Dependencies: I have listed all the libraries available in
the directory mentioned above.
But when I run I get that error. This library actually exists in the mentioned directory, but I don't know why I get this error. I have seen some other people ask similar questions, but none of the solutions could solve my problem.
use dependency walker tool to make sure u have all necessary dlls & libs loaded...
'opencv_calib3d243.obj' != 'opencv_calib3d243.lib' !
it should be 'lib', but you probably typed 'obj' there (which does not exist), look at it again.
Go to Project properties ->Configuration Properties -> Linker -> Input -> Additional Dependencies
In additional dependencies add
opencv_core243.lib
opencv_imgproc243.lib
opencv_highgui243.lib
opencv_ml243.lib
opencv_video243.lib
opencv_features2d243.lib
opencv_calib3d243.lib
opencv_objdetect243.lib
opencv_contrib243.lib
opencv_legacy243.lib
opencv_flann243.lib
If you have already added , make sure you have added opencv_calib3d243.lib
had the same problem, except VS was complaining about opencv_.obj instead, (I'm running it under visual studio 2010 express)
Fixed it by copying and pasting the lib dependencies from the provided "opencv_example" example (Project properties->linker->Input:Additional Dependencies).
So for convenience, I have this value in my Additional Dependencies:
opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;%(AdditionalDependencies)
Note I: I'm running version 246, so you may have to adjust these names to reflect your installed version which appears to be 243
Note II: I'm compiling for debug, haven't tried release, but you should remove the trailing 'd' from the lib name for correctness.

Building Qt for Visual Studio 2010 - cannot open file 'qtmaind.lib'

I'm trying to start a C++ Qt application and have it run and compile in Visual Studio 2010.
Doing some googling, I found that there was a Visual Studio Qt Add-in, and so I installed this. I already had a MinGW Qt binary installed, and when this did not work, I found that you have to compile the source for Visual Studio 2010 (the VS 2008 binary will cause deployment issues).
Using this as a guide: How to build Qt for Visual Studio 2010, I compiled the open source version, and added it to the PATH, along with a QTDIR env variable. Hoping that I got it finally working, I created a "Qt Application" using the New Project Wizard in Visual Studio 2010. Once I finished, I tried to build the program, only to see the following error:
1>LINK : fatal error LNK1104: cannot open file 'qtmaind.lib'
I looked in the C:\QT\lib folder, and found that I only have a qtmaind.prl, but no clue as to why there is no qtmaind.lib.
I am able to echo the QMAKESPEC environmental variable to get a 'win32-msvc2010' output.
I've tried several different combinations of flags for the configure step, including the one in the link, and even tried manually setting the -platform flag.
If anyone can offer any help, it would be greatly appreciated! :D
Just ran across this same problem. I changed the "-release" flag from the linked guide to "-debug-and-release", and then it built the qtmaind.lib library (presumably, that "d" suffix stands for debug).
I encountered this issue when running a project whose settings were hardcoded for a particular machine setup.
I could see that the vcxproj file had something like:
C:\Qt\4.8.1\libqtmaind.lib
I could not find this lib file in my machine. I replaced the line by:
C:\Qt\4.7.3\lib\Qtmaind.lib
It looks like the names of library files are different across Qt versions.Or, maybe the library files were renamed.
Also, the 'd' denoted debug. If you cannot find any lib file post-fixed by 'd', it is likely that you did not 'make' a debug version of Qt.
You can cross check this by opening the .Sln file created by configure. Mine was named Projects.sln. You can open this in notepad and see if win32-debug configurations are present.
This might be a QMAKESPEC issue. Try setting your QMAKESPEC environment variable to
win32-msvc2010
and rebuild Qt like that. This should give you .lib files in your Qt folder
in QT 5.3 with vs 2013
in properties -> linker -> input
remove ANY path for qt libraries such qtmaind.lib
this is known BUG

How do I use libcurl in Visual C++ 2010?

Hey guys, I was wondering if you would be able to help me use libcurl within Visual Studio to resolve the errors in the image below:
It looks like you need to update Visual Studio's configuration to include the directories where you've installed cURL. VS has directories for both Include files and libraries -- if memory serves, you'll have to add both.
I too ran into same issue. The problem is, i was pointing in additinal lib dirs to lib/LIB-Debug instead lib/DLL-Debug. Also the lib to add is libcurld_imp.lib and not libcurld.lib. Also you need to copy libcurld.dll into executable file location. I see that there are lib/LIB-Debug dir and lib file but dont know what they are for. You have to do use DLL-Release, libcurl_imp.lib etc for release mode.

fatal error LNK1104 cannot open file C:\users\user\documents\visual.obj

I get a "fatal error LNK1104 cannot open file C:\users\user\documents\visual.obj" whenever I want to compile my project on Visual Studio 2008.
my project uses a .lib file that I created.
can anyone help me out ?
Thanks , guyz. I've found the solution to my problem. I had to add quotes around the path to my .lib file in Project->Properties->Configuration Properties->Linker->Input->Additional Dependencies .
Make sure that the directory C:\users\user\documents\ exists and that you have read/write access to it.
With this http://www.google.de/search?q=visual+studio+2008+LNK1104 I found this answer by http://social.msdn.microsoft.com/Forums/en-US/user?user=einaros.
You need to add the DirectX library folder to Visual Studio's search path. See the "Directories" settings under Tools -> Options -> Projects and Solutions. Otherwise the linker will not know where to find d3dx9.lib.

Resources