foreword
Thanks to the students at station B for carrying the teaching videos on YouTube.
Get GLFW
Download the 64-bit binary file for GLFW macOS from the official website
Open VS
- Create a new solution
OpenGL test
and create a new folder in the solutionDependencies
:
-
Find the latest version of the link file and file from the downloaded
glfw
folderinclude
, and move them toDependencies/GLFW
the path :
-
lib-vc2022
But not all the things in the folder are what we need, we only need.lib
the library file, and delete the other three files.
- Open the properties of the solution:
- Add path for
C/C++ -> 常规
in :附加包含目录
链接器->输入
For附加依赖项
the addglfw3.lib
,opengl32.lib
file in:
Here is a very interesting place. In the video, cherno directly deletes all the default dependencies that come with VS, and build
then error - lack of dependencies, and the solution is:
-
Pick missing dependency names:
-
Google it, and you will know:
-
According to the tips of MSDN documentation, add the corresponding dependency files
链接器->输入
in : This can be regarded as teaching a man how to fish rather than giving him a fish.附加依赖项
Closer to home, after the above operations, the code should no longer be marked in red:
Run it and try:
Got a window named Hello World
and 640 X 480
sized .
Use legacy opengl
to draw a triangle:
you're done~