Some memo left for Visual Studio dummies like me
Open Project Properties:
Right-click on your project in the Solution Explorer and select "Properties". Add Additional Include Directories:
Go to Configuration Properties -> VC++ Directories -> Include Directories
.
Add the path to the ImGui directory, e.g., $(SolutionDir)imgui
.
Undefine #define USE_IMGUI
if you don't want to use ImGui.
- Open Project Properties:
- Right-click on your project in the Solution Explorer and select "Properties".
- Add Additional Include Directories:
- Go to Configuration
Properties -> VC++ Directories -> Include Directories
. - Add the path to the DirectX SDK include directory, e.g.,
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
. - Add the path to the ImGui directory, e.g.,
$(SolutionDir)imgui
.
- Go to Configuration
- Add Additional Library Directories:
- Go to Configuration
Properties -> VC++ Directories -> Library Directories
. - Add the path to the DirectX SDK library directory, e.g.,
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
.
- Go to Configuration
- Add Additional Dependencies:
- Go to Configuration
Properties -> Linker -> Input -> Additional Dependencies
. - Add
d3d11.lib;D3DCompiler.lib;
to the list.
- Go to Configuration
If adding an HLSL shader file to your project causes an "entry point not found" error, it suggests that the issue might be related to how the shader file is being compiled or linked within the project. Here are some steps to troubleshoot and resolve this issue:
Steps to Resolve the Issue
- Ensure Shader Compilation is Separate: Make sure that the HLSL shader file is not being treated as a C++ source file. It should be compiled separately using the DirectX shader compiler.
- Exclude Shader from Build: Ensure that the shader file is excluded from the C++ build process.
- Correctly Compile Shaders: Use the appropriate DirectX functions to compile the shaders at runtime.
Detailed Steps
- Ensure Shader Compilation is Separate HLSL shader files should not be compiled as part of the C++ build process. They should be compiled using the DirectX shader compiler (e.g., D3DCompileFromFile).
- Exclude Shader from Build
- Right-click on the Shader File:
- In the Solution Explorer, right-click on the shader file (e.g., shader.hlsl).
- Properties:
- Select "Properties" from the context menu.
- Exclude from Build:
- In the Properties window, set "Item Type" to "Does Not Participate in Build".
- Right-click on the Shader File: