Skip to content

Instantly share code, notes, and snippets.

@grpnpraveen
Last active March 6, 2023 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grpnpraveen/59f466924c15bee7a2d7697607658809 to your computer and use it in GitHub Desktop.
Save grpnpraveen/59f466924c15bee7a2d7697607658809 to your computer and use it in GitHub Desktop.
How to run an OpenGL cpp file from Terminal ?
# I Used GLEW and GLFW for this
# @Note I used MSYS2 for this , to download glfw and glew using MSYS2 use below commands
# pacman -S mingw-w64-x86_64-glfw and pacman -S mingw-w64-x86_64-glew
# for cpp compiler I used MinGW which can also be downloaded in MSYS2
# Step 1: to generate obj file , basically only compiling
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o main.obj main.cpp
## Command 1 description
## -O0 means optimisation level 3 , -g3 debugging level 3, -Wall to print all warnings, -c only compile
# Step 2:
g++ -o main.exe main.obj -lglfw3 -lglew32 -lopengl32 -lglu32 -lfreeglut
## Command 2 description
## -lglfw3 linking the glfw3.dll glew32.dll opengl32.dll glu32.dll
@grpnpraveen
Copy link
Author

init

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment