Link build and run program without IDE (C, OPENGL, GLFW, GLEW) | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Link build and run program without IDE (C, OPENGL, GLFW, GLEW)

Hi, so I have one project in visual studio, it's just a simple empty window program written in C with GLFW as window handler and GLEW for accesing OpenGL functions. I'm wondering how can I compile it with GCC. gcc main.c -o my_program will compile the code and create executable with the name my_program. What if I want to link some libraries (like GLFW and GLEW)?. How would the compile command look like?

13th Oct 2020, 6:57 PM
Kry$tof
2 Respostas
- 1
gcc main.c -o my_program -lGLEW For GLFW -lglfw
13th Oct 2020, 9:26 PM
Alex
Alex - avatar
- 1
@Alex Are you sure this is everything I need? OK, i assume that the header files are in same folder. the libs have different names and how about Additional dependecies? In VS 2019 I have to add opengl32.lib, glew32.lib and glfw3.lib
14th Oct 2020, 3:19 PM
Kry$tof