From 5e17847af54dc7fe804cea59f9110e2286f87ab1 Mon Sep 17 00:00:00 2001 From: ngwd Date: Tue, 27 May 2025 11:36:58 -0700 Subject: [PATCH 1/2] Fix the runtime issue "cannot find the freeglut.dll" --- HelloGLUT/HelloGLUT.vcxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/HelloGLUT/HelloGLUT.vcxproj b/HelloGLUT/HelloGLUT.vcxproj index 36db111..5805b85 100644 --- a/HelloGLUT/HelloGLUT.vcxproj +++ b/HelloGLUT/HelloGLUT.vcxproj @@ -120,6 +120,9 @@ mainCRTStartup freeglut.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + xcopy /Y "C:\Program Files\Common Files\freeglut\bin\freeglut.dll" "$(OutDir)" + @@ -135,6 +138,9 @@ mainCRTStartup freeglut.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + xcopy /Y "C:\Program Files\Common Files\freeglut\bin\$(Platform)\freeglut.dll" "$(OutDir)" + From 9f2f20cba4390b1555969f54995cecd3283d51d4 Mon Sep 17 00:00:00 2001 From: ngwd Date: Tue, 27 May 2025 19:17:47 -0700 Subject: [PATCH 2/2] introduce the glew32.lib --- HelloGLUT/HelloGLUT.c | 10 ++++++++++ HelloGLUT/HelloGLUT.vcxproj | 36 +++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/HelloGLUT/HelloGLUT.c b/HelloGLUT/HelloGLUT.c index 129aac7..a2c1fb8 100644 --- a/HelloGLUT/HelloGLUT.c +++ b/HelloGLUT/HelloGLUT.c @@ -5,6 +5,9 @@ */ #include +#include +// Always include glew.h before freeglut.h or gl.h +#include #include #include "Callbacks.h" @@ -15,6 +18,13 @@ int main(int argc, char** argv) /* Create a single window with a keyboard and display callback */ glutCreateWindow("GLUT Test"); + + GLenum err = glewInit(); + if (GLEW_OK != err) { + printf("GLEW init failed: %s\n", glewGetErrorString(err)); + return 1; + } + glutKeyboardFunc(&keyboard); glutDisplayFunc(&display); diff --git a/HelloGLUT/HelloGLUT.vcxproj b/HelloGLUT/HelloGLUT.vcxproj index 5805b85..b6aa164 100644 --- a/HelloGLUT/HelloGLUT.vcxproj +++ b/HelloGLUT/HelloGLUT.vcxproj @@ -30,33 +30,33 @@ {874EFCB1-9F7F-4C5F-B1B1-74800120AE66} Win32Proj HelloGLUT - 10.0.16299.0 + 10.0 Hello GLUT Application true - v141 + v143 MultiByte Application false - v141 + v143 true MultiByte Application true - v141 + v143 MultiByte Application false - v141 + v143 true MultiByte @@ -82,29 +82,29 @@ true $(SolutionDir)$(Configuration)\$(Platform)\ $(Configuration)\$(Platform)\ - C:\Program Files\Common Files\freeglut\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - C:\Program Files\Common Files\freeglut\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 + C:\Program Files\Common Files\freeglut\include;C:\Program Files\Common Files\glew-2.1.0\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + C:\Program Files\Common Files\freeglut\lib;C:\Program Files\Common Files\glew-2.1.0\lib\Release\$(Platform);$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 true $(SolutionDir)$(Configuration)\$(Platform)\ $(Configuration)\$(Platform)\ - C:\Program Files\Common Files\freeglut\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - C:\Program Files\Common Files\freeglut\lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 + C:\Program Files\Common Files\freeglut\include;C:\Program Files\Common Files\glew-2.1.0\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + C:\Program Files\Common Files\freeglut\lib\x64;C:\Program Files\Common Files\glew-2.1.0\lib\Release\$(Platform);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 false $(SolutionDir)$(Configuration)\$(Platform)\ $(Configuration)\$(Platform)\ - C:\Program Files\Common Files\freeglut\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - C:\Program Files\Common Files\freeglut\lib;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 + C:\Program Files\Common Files\freeglut\include;C:\Program Files\Common Files\glew-2.1.0\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + C:\Program Files\Common Files\freeglut\lib;C:\Program Files\Common Files\glew-2.1.0\lib\Release\$(Platform);$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86 false $(SolutionDir)$(Configuration)\$(Platform)\ $(Configuration)\$(Platform)\ - C:\Program Files\Common Files\freeglut\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); - C:\Program Files\Common Files\freeglut\lib\x64;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 + C:\Program Files\Common Files\freeglut\include;C:\Program Files\Common Files\glew-2.1.0\include;$(VC_IncludePath);$(WindowsSDK_IncludePath); + C:\Program Files\Common Files\freeglut\lib\x64;C:\Program Files\Common Files\glew-2.1.0\lib\Release\$(Platform);$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64 @@ -121,7 +121,8 @@ freeglut.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - xcopy /Y "C:\Program Files\Common Files\freeglut\bin\freeglut.dll" "$(OutDir)" + xcopy /Y "C:\Program Files\Common Files\freeglut\bin\freeglut.dll" "$(OutDir)" +xcopy /Y "C:\Program Files\Common Files\glew-2.1.0\bin\Release\$(Platform)\glew32.dll" "$(OutDir)" @@ -136,10 +137,11 @@ Windows true mainCRTStartup - freeglut.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + freeglut.lib;glew32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - xcopy /Y "C:\Program Files\Common Files\freeglut\bin\$(Platform)\freeglut.dll" "$(OutDir)" + xcopy /Y "C:\Program Files\Common Files\freeglut\bin\$(Platform)\freeglut.dll" "$(OutDir)" +xcopy /Y "C:\Program Files\Common Files\glew-2.1.0\bin\Release\$(Platform)\glew32.dll" "$(OutDir)" @@ -158,7 +160,7 @@ true true mainCRTStartup - freeglut.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + freeglut.lib;glew32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)