Direct3d basic one __CPP basic encounter can not open the source file D3DX11.h how to solve

tossing again

content

Install visual studio and c++

Install DirectX

link project

Everything else is just a little problem

refer to:


Install visual studio and c++

When it comes to writing programs, no matter how small a program is written, it will not be worry-free:

The first is to install vs2019. At the beginning, it was just a C# tool, and .net and basic c++ support were installed;

Didn't pay attention, didn't install: c++ desktop xxx tool

Later, I remembered that I wanted to develop CPP, but suddenly I couldn't install the extension, and I couldn't connect to the network to download. The solution

===================================================

(A lot of people on the Internet say that the method of changing the hosts will not work. The following brother can download the method of changing the dns
method.) My problem is exactly the same as that of the title owner. After two or three days of tossing, I still cannot download it. Baidu has tried many methods to no avail. I didn't solve it until today, when our C++ teacher posted it in the group. You can really get down! ! ! And the method is very simple specific method:

Modify the DNS address of the computer network to 114.114.114.114 (domestic DNS address)

Change the alternate address to 8.8.8.8 or 8.8.4.4 (Google's DNS address).

The modified method can be Baidu. I modified it and I can download it, I am really happy! ! !

==================================================

problem solving one

Install DirectX

Download DirectX Software Development Kit from Official Microsoft Download Center

Solution steps:

(1) To resolve this issue, uninstall all versions of Visual C++ 2010 Redistributable components present in the computer before June 2010 DirectX SDK installation.

It can be uninstalled directly in the Programs and Features panel. Alternatively, uninstall by running the following command from the command line :

  MsiExec.exe /passive /X{F0C3E5D1-1ADE-321E-8167-68EF0DE699A5}
  MsiExec.exe /passive /X{1D8E6291-B0D5-35EC-8441-6616F567A0F7}

Problem Solving: Two

link project

This is also a headache

————————————————

"LNK1104: Unable to open file d3dx11.lib" appears in the DirextX11 project. Possible reasons:
Project Properties->VC++ Directory->Library Directory, added "D:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\ Lib".
It turns out that there are two folders \X86 and \X64 under ".\Lib", each with a copy of d3dx11.lib, so you need to specify whether it is under X86 or under X64, and change it to "D:\Program Files (x86) \Microsoft DirectX SDK (June 2010)\Lib\X86" will do.
———————————————
 

Problem Solving: Three

Another day passed. . . . . . . the next day. . . . .

If you follow the instructions in the Direct3D Dragon Book, "Introduction to 3D Game Programming with Direct3D 11", (I thought this book was talking about DirectX, I thought it was talking about game program, it actually has nothing to do with game development, it actually said 3d data base) there is a high probability of encountering this problem

FXC : error X3501: 'main': entrypoint not found

 Since our project is called WindowProject1

Of course there is also a class with the same name,

WindowProject1.cpp

Subconsciously, you will think that the error lies in this file,,, and it is not.

Solution reference:

c++ - FXC : error X3501: 'main': entrypoint not found - Stack Overflow

It's probably because I'm in the project, and I've mixed in the .fx file

Solve problem four

Thank goodness, it only took one and a half days to solve 1~4 problems in the end, and the pits are not too many.

After starting the code, the interface is as follows:

Everything else is just a little problem

1. Using the CreateVertexShader method, the shader file needs to be placed in the following directory (the relative path does not know how to write it temporarily)

d3dDevice->CreateVertexShader(VertexShaderBuffer->GetBufferPointer(),VertexShaderBuffer->GetBufferSize(),NULL,&md3dVertexShader)

2. In the upper part of the code editor window, a drop-down list is provided for quick positioning, all classes, all methods

3. Ctrl + K + O (Ctrl + KO), not 0, can quickly switch between .cpp and .h header files

4. The official CPP entry is written like this, but you can also feel free to

//vs 2019 -cpp
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPWSTR    lpCmdLine,
                     _In_ int       nCmdShow)

that's okay

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
   
   

5. Static methods are checked for duplicates at compile time

//LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);

6. Direct Effect is not compiled

refer to:

Direct3D11 Learning: (1) Development Environment Configuration - Guo Xiaolei - Blog Park

Guess you like

Origin blog.csdn.net/avi9111/article/details/123564725