So I've reinstalled directx11 a couple times and even went to the Microsoft website and got the SDK pack that has all the direct x cabinet files in it. Anyone have any idea why i keep getting this error then? I know why it is saying it but more looking for the solution to it.
1>c:\users\vaughn\documents\visual studio
2010\projects\myfirstapp\myfirstapp\main.cpp(5): fatal error C1083:
Cannot open include file: 'd3dx11.h': No such file or directory
That's what you need to do in VS 2010 (it looks a bit different in VS 2008 and earlier):
Go to your project's properties | Configuration Properties | VC++ Directories. Edit line called Include Directories by adding path to DirectX header files. As for June 2010 SDK it may be something like:
32 bit Win: C:\Program Files\Microsoft DirectX SDK (June 2010)\Include
64 bit Win: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
Next you are most likely to get a linker's error (missing .lib files). Just go to your project's properties | Configuration Properties | VC++ Directories again, but this time edit Library Directories and add to one of the following paths:
32 bit Win: C:\Program Files\Microsoft DirectX SDK (June 2010)\Lib\x86
64 bit Win: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
If you installed other version of SDK or installed it to non-default directory change given paths accordingly. Also make sure you added d3d11.lib (and maybe d3dx11.lib as well) to Linker | Additional Dependencies.
General rule is that any time you #include <> files your IDE needs to know where to find them. VC++ Directories is one way of doing that in Visual Studio. But sole inclusion of headers is (in most cases) not enough - you need to tell your linker where to look for precompiled binaries described by those headers. That what you do by adding the second path to Library Directories.
You have to make sure you get the latest DirectX SDK. It has the header files. If all you got were cabinet files, you got the wrong SDK.
In my case, for DX12, I was missing d3dx12.h
See this MSDN page.
In case the page moves, the relevant line appears to be
"d3dx12.h is available separately from the Direct3D 12 headers. You can download d3dx12.h by navigating into any of the source files for the Direct3D 12 projects at GitHub/Microsoft/DirectX-Graphics-Samples"
Related
I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're curious) and tried to compile it.
Visual Studio tells me that it can't find a particular header file. I found the file in the source tree, but where do I need to put it, so that it will be found when compiling?
Are there special directories?
Visual Studio looks for headers in this order:
In the current source directory.
In the Additional Include Directories in the project properties (Project -> [project name] Properties, under C/C++ | General).
In the Visual Studio C++ Include directories under Tools → Options → Projects and Solutions → VC++ Directories.
In new versions of Visual Studio (2015+) the above option is deprecated and a list of default include directories is available at Project Properties → Configuration → VC++ Directories
In your case, add the directory that the header is to the project properties (Project Properties → Configuration → C/C++ → General → Additional Include Directories).
Actually, on my windows 10 with visual studio 2017 community, the path of the C++ header are:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\ucrt
The 1st contains standard C++ headers such as <iostream>, <algorithm>. The 2nd contains old C headers such as <stdio.h>, <string.h>. The version number can be different based on your software.
If the project came with a Visual Studio project file, then that should already be configured to find the headers for you. If not, you'll have to add the include file directory to the project settings by right-clicking the project and selecting Properties, clicking on "C/C++", and adding the directory containing the include files to the "Additional Include Directories" edit box.
There seems to be a bug in Visual Studio 2015 community. For a 64-bit project, the include folder isn't found unless it's in the win32 bit configuration Additional Include Folders list.
There exists a newer question what is hitting the problem better asking How do include paths work in Visual Studio?
There is getting revealed the way to do it in the newer versions of VisualStudio
in the current project only (as the question is set here too) as well as
for every new project as default
The second is the what the answer of Steve Wilkinson above explains, what is, as he supposed himself, not the what Microsoft would recommend.
To say it the shortway here: do it, but do it in the User-Directory at
C:\Users\UserName\AppData\Local\Microsoft\MSBuild\v4.0
in the XML-file
Microsoft.Cpp.Win32.user.props
and/or
Microsoft.Cpp.x64.user.props
and not in the C:\program files - directory, where the unmodified Factory-File of Microsoft is expected to reside.
Then you do it the way as VisualStudio is doing it too and everything is regular.
For more info why to do it alike, see my answer there.
Tried to add this as a comment to Rob Prouse's posting, but the lack of formatting made it unintelligible.
In Visual Studio 2010, the "Tools | Options | Projects and Solutions | VC++ Directories" dialog reports that "VC++ Directories editing in Tools > Options has been deprecated", proposing that you use the rather counter-intuitive Property Manager.
If you really, really want to update the default $(IncludePath), you have to hack the appropriate entry in one of the XML files:
\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets\v100\Microsoft.Cpp.Win32.v100.props
or
\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\PlatformToolsets\v100\Microsoft.Cpp.X64.v100.props
(Probably not Microsoft-recommended.)
It looks for files in the directory mentioned in options" cwd, you can include all sub directory under a path as shown below.
it will create a single output file.
it will compile all files together in the directory specified in cwd
project Structure:
moduelTest
-header_files
- util.h
-source_files
- util.c
- main.c
Having installed VS 2019 on my PC, and opening up a new project, i get 408 errors that all say it cannot open various source .h files, such as errno.h, float.h, corecrt.h, etc. or 'the global scope has no "acosf" 'I had just installed visual studio and have no clue how it works, and have not done anything other than install it and open up a new project.
Possibly useful information:
It was not installed in the default location, but on the D: drive
visual studio works fine when I open it with unity to edit scripts for my unity projects, but when opening it from its desktop icon or from the start menu, i get the errors
Unity was installed before i installed Visual studio and appears to be using a different version of visual studio somewhere else on my PC, but i cant find where it is, hence me installing it myself
The project is a C++ project
I have already tried repairing visual studio and reinstalling it, but it did not work.
I had the same issue (here), the problem is that for some reason, MSVS is not adding the Windows Universal CRT SDK to the include and library paths (this SDK has the header files for things like "float.h" and so on).
To add it to your project, you need to add the include and lib paths in the Project settings.
In my case they were:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt <- header path
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.18362.0\ucrt\x64 <- library path
(you can find it by searching for "float.h", and "ucrtd.lib", but be careful not to use the path for Linux headers).
You can add these paths at: Project Properties -> C/C++ -> General -> Additional Include Directories (add header path here)
and then Project Properties -> Linker -> General -> Additional Library directories (add library path here).
I suggest you could to check the version of Windows SDK in visual studio installer. And then set the appropriate version of windows sdk in the property -> General -> windows SDK version.
I have a VS 2015 C++ project (64-bit Windows 10 + Windows 10 SDK).
With the Project Properties > General > Target Platform Version set to "8.1", everything builds fine.
When I change it to "10.0.15063.0", I hit this error:
Error TRK0005 Failed to locate: "rc.exe". The system cannot find the file specified.
I saw from other posts that the fix is to paste the exe to somewhere it can be found. I'm looking for something a bit more solid (e.g. version controlled).
When set to 8.1, the $(WindowsSDK_ExecutablePath) macro includes this path:
C:\Program Files (x86)\Windows Kits\8.1\bin\x86
with rc.exe in it.
When set to 10.0.15063.0, none of the paths in the macro have an rc.exe inside them. If I add this path to the Executable Directories, the problem goes away:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
My questions:
Is what I'm seeing expected or should rc.exe be found out-the-box?
Is it safe for me to add this extra path or am I likely to break something?
Am I using the correct extra path? (The 8.1 path includes "x86".)
Thanks
1) rc.exe should be found out of the box.
The issue may be related to a different Windows 10 SDK path schemes which was changed in newer Windows 10 SDKs.
Please, check, if VS2015 files point to the folder
C:\Program Files (x86)\Windows Kits\10\bin\x64
(You can see the value of the macro for $(WindowsSDK_ExecutablePath)).
Latest Windows 10 SDK are installed in parallel subfolders so you may install different Windows 10 SDK, with folders like:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x64
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x64
If VS expects SDK in general folder - Windows Kits\10\bin\, you may copy rc.exe, rc.dll there from bin\10.0.15063.0\ (from \x86 to \x86, from \x64 to \x64).
This is inconsistency in VS2015 / Win 10 SDK install.
2) If you put actual rc.exe path into the Project Properties > Configuration Properties > Executable Directories, at the end, it is generally safe. Paths are iterated from left to right, and the last one will be searched only if .exe was not found in the previous predefined ones.
3) VS may build .rc resource files always with 32-bit rc.exe from \x86 folder, depending on the variable in Executable Paths. It may be set to $(WindowsSDK_ExecutablePath).
This actually should not matter, as these are 32-bit / 64-bit versions of the compiler executables with equivalent functionality.
You can track which compiler .exe files MSBuild invokes in Output window, if increase verbosity:
Tools > Options > Projects and Solutions > Build and Run > MSBuild project build output verbosity > Detailed.
Not the cleanest solution but here's how I solved it, as #Alexey said, I also have 2 SDKs, 10 and 8.1 and probably that's where the error came from.
I just added the path:
C:\Program Files(x86)\Windows Kits\8.1\bin\x64
to the PATH in Windows environment variables
Note: The x64 at the end of the path, needs to be changed if you are compiling for a different architecture.
In addition, the path is where the rc.exe is located on my PC, you should make sure that it is indeed in the same place on your PC as well.
Do not forget to close and reopen Visual Studio after the change to update the environment variables.
I installed one of the latest Windows SDK version, 10.0.19041.0,and found that the rc.exe is there the architecture folder under the SDK version in the bin folder. Here is what I mean:
C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64
I found a number of default Macros already created so I use them to make the path more generic in case if I have to change the platform target to a differernt version.
This is the path using the Macro and it's working for me.
$(WindowsSdkDir)bin\$(WindowsTargetPlatformVersion)\$(PlatformTarget)
So, the rc.exe is there. You just need to find where it is and add its path to the VC++ Directories\Executable Directories in the configuration dialog.
Recently been trying to link needed include/libraries to my DirectX 9 project from the 'Microsoft DirectX SDK (June 2010)'. However when I compile I get the following: 1>LINK : fatal error LNK1104: cannot open file 'd3d9.h'. NOTE: I'm using Windows 10 with Visual Studio 2015.
Here is what I have done so far with the project settings in order to link the necessary files.
1. In VC++ Directories I have linked the Include and Library(x86).
In Linker>Input>Additional Dependencies I have added the necessary header files from DirectX 9. These are d3d9.h and d3dx9.h.
Here are my include statements. I only include d3d9.h and d3dx9.h from DirectX 9.
As #Youka said in his comment, you shouldn't be linking header files. You link libraries - and this doesn't vary between versions of Visual Studio. Instead of having d3d9.h and d3dx9.h in the linker settings, you will want instead d3d9.lib and d3dx9.lib.
I just installed Visual Studio 2012 today, and I was wondering how can you install GLUT and OpenGL on the platform?
OpenGL should be present already - it will probably be Freeglut / GLUT that is missing.
GLUT is very dated now and not actively supported - so you should certainly be using Freeglut instead. You won't have to change your code at all, and a few additional features become available.
You'll find pre-packaged sets of files from here:
http://freeglut.sourceforge.net/index.php#download
If you don't see the "lib" folder, it's because you didn't download the pre-packaged set.
"Martin Payne's Windows binaries" is posted at above link and works on Windows 8.1 with Visual Studio 2013 at the time of this writing.
When you download these you'll find that the Freeglut folder has three subfolders:
- bin folder: this contains the dll files for runtime
- include: the header files for compilation
- lib: contains library files for compilation/linking
Installation instructions usually suggest moving these files into the visual studio folder and the Windows system folder: It is best to avoid doing this as it makes your project less portable, and makes it much more difficult if you ever need to change which version of the library you are using (old projects might suddenly stop working, etc.)
Instead (apologies for any inconsistencies, I'm basing these instructions on VS2010)...
- put the freeglut folder somewhere else, e.g. C:\dev
- Open your project in Visual Studio
- Open project properties
- There should be a tab for VC++ Directories, here you should add the appropriate include and lib folders, e.g.: C:\dev\freeglut\include and C:\dev\freeglut\lib
- (Almost) Final step is to ensure that the opengl lib file is actually linked during compilation. Still in project properties, expand the linker menu, and open the input tab. For Additional Dependencies add opengl32.lib (you would assume that this would be linked automatically just by adding the include GL/gl.h to your project, but for some reason this doesn't seem to be the case)
At this stage your project should compile OK. To actually run it, you also need to copy the freeglut.dll files into your project folder
This is GLUT installation instruction. Not free glut
First download this 118 KB GLUT package from Here
Extract the downloaded ZIP file and make sure you find the following
glut.h
glut32.lib
glut32.dll
If you have a 32 bits operating system, place glut32.dll to C:\Windows\System32\, if your operating system is 64 bits, place it to 'C:\Windows\SysWOW64\' (to your system directory)
Place glut.h C:\Program Files\Microsoft Visual Studio 12\VC\include\GL\ (NOTE: 12 here refers to your VS version it may be 8 or 10)
If you do not find VC and following directories.. go on create it.
Place glut32.lib to C:\Program Files\Microsoft Visual Studio 12\VC\lib\
Now, open visual Studio and
Under Visual C++, select Empty Project(or your already existing project)
Go to Project -> Properties. Select 'All Configuration' from Configuration dropdown menu on top left corner
Select Linker -> Input
Now right click on "Additional Dependence" found on Right panel and click Edit
now type
opengl32.lib
glu32.lib
glut32.lib
(NOTE: Each .lib in new line)
That's it... You have successfully installed OpenGL.. Go on and run your program.
Same installation instructions aplies to freeglut files with the header files in the GL folder, lib in the lib folder, and dll in the System32 folder.
OpenGL is bundled with Visual Studio. You just need to install GLUT package (freeglut would be fine), which can be found in NuGet.
Open your solution, click TOOLS->NuGet Package Manager->Package Manager Console to open a NuGet console, type Install-Package freeglut.
--
For VS 2013, use nupengl.core package instead.
--
It's 2020 now. Use VCPKG.
For Microsoft Visual Studio 2017 Community GLUT installation -
Download the header, dll's and lib files fro glutdlls37beta (linked in here)
Paste glut.h in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\include\GL
Create the GL folder if not present already. The {thing} may differ.
Paste glut.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x64.
Paste glut32.lib in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\{14.11.25503}\lib\x86.
The {thing} may differ.
Paste glut32.dll in C:\Windows\System32. Paste glut.dll and glut32.dll in C:\Windows\SysWOW64.
Follow Vishwanath gowda k's answer next.
Go to Project -> Properties(All Configuration option)->Linker -> Input -> Additional Dependencies->edit(down arrow on the right end)
Type->
opengl32.lib
glu32.lib
glut32.lib
Hit Ok->apply.
For an easy and appropriate way of doing this, first download a prepackaged release of freeglut from here. Then read its Readme.txt.
I copied some important parts of that package here:
... Create a folder on your PC which is readable by all users, for example “C:\Program Files\Common Files\MSVC\freeglut\” on a typical Windows system. Copy the “lib\” and “include\” folders from this zip archive to that location ... freeglut DLL can be placed in the same folder as your application...
... Open up the project properties, and select “All Configurations” (this is necessary to ensure our changes are applied for both debug and release builds). Open up the “general” section under “C/C++”, and configure the “include\” folder you created above as an “Additional Include Directory”. If you have more than one GLUT package which contains a “glut.h” file, it’s important to ensure that the freeglut include folder appears above all other GLUT include folders ... Open up the “general” section under “Linker”, and configure the “lib\” folder you created above as an “Additional Library Directory”...
Download the GLUT library. At first step Copy the glut32.dll and paste it in C:\Windows\System32 folder.Second step copy glut.h file and paste it in C:\Program Files\Microsoft Visual Studio\VC\include folder and third step copy glut32.lib and paste it in c:\Program Files\Microsoft Visual Studio\VC\lib folder.
Now you can create visual c++ console application project and include glut.h header file then you can write code for GLUT project.
If you are using 64 bit windows machine then path and glut library may be different but process is similar.
Yes visual studio 2012 express has built in opengl library. the headers are in the folder
C:\Program Files\Windows Kits\8.0\Include\um\gl and the lib files are in folder C:\Program Files\Windows Kits\8.0\Lib\win8\um\x86 & C:\Program Files\Windows Kits\8.0\Lib\win8\um\x64. but the problem is integrating the glut with the existing one..
i downloaded the library from http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip.. and deployed the files into .....\gl and ....\lib\win8\um\x32 and the dll to %system%/windows folders respectively.. Hope so this will solve the problem...
Download and install Visual C++ Express.
Download and extract "freeglut 2.8.0 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Installation for Windows 32 bit:
(a) Copy all files from include/GL folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\gl folder.
(b) Copy all files from lib folder and paste into C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib folder.
(c) Copy freeglut.dll and paste into C:\windows\system32 folder.
Use NupenGL Nuget package. It is actively updated and works with VS 2013 and 2015, whereas Freeglut Nuget package works with earlier versions of Visual Studio only (as of 10/14/2015).
Also, follow this blog post for easy instructions on working with OpenGL and Glut in VS.
the instructions for Vs2012
To Install FreeGLUT
Download "freeglut 2.8.1 MSVC Package" from http://www.transmissionzero.co.uk/software/freeglut-devel/
Extract the compressed file freeglut-MSVC.zip to a folder freeglut
Inside freeglut folder:
On 32bit versions of windows
copy all files in include/GL folder to C:\Program Files\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files\Windows Kits\8.0\Lib\win8\um\
(note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\system32
On 64bit versions of windows:(not 100% sure but try)
copy all files in include/GL folder to C:\Program Files(x86)\Windows Kits\8.0\Include\um\gl
copy all files in lib folder to C:\Program Files(x86)\Windows Kits\8.0\Lib\win8\um\
(note: Lib\freeglut.lib in a folder goes into x86)
copy freeglut.dll to C:\windows\SysWOW64
Create a empty win32 console application c++
Download a package called NupenGL Core from Nuget package manager
(PM->"Install-Package nupengl.core")
except glm everything is configured
create Source.cpp and start working
Happy Coding