Clean: Debug in tuto7 (compiler: GNU GCC Compiler)---------------
Cleaned "tuto7 - Debug"
-------------- Build: Debug in tuto7 (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -g -IC:\Users\\Desktop\ogl-master\common -IC:\Users\\Desktop\ogl-master\external\glm-0.9.7.1 -IC:\msys64\mingw64\include\GL -IC:\msys64\mingw64\include -IC:\newton-dynamics-master\sdk\dgNewton -c C:\Users\\Desktop\ogl-master\common\controls.cpp -o obj\Debug\common\controls.o
g++.exe -Wall -g -IC:\Users\\Desktop\ogl-master\common -IC:\Users\\Desktop\ogl-master\external\glm-0.9.7.1 -IC:\msys64\mingw64\include\GL -IC:\msys64\mingw64\include -IC:\newton-dynamics-master\sdk\dgNewton -c C:\Users\\Desktop\ogl-master\common\objloader.cpp -o obj\Debug\common\objloader.o
g++.exe -Wall -g -IC:\Users\\Desktop\ogl-master\common -IC:\Users\\Desktop\ogl-master\external\glm-0.9.7.1 -IC:\msys64\mingw64\include\GL -IC:\msys64\mingw64\include -IC:\newton-dynamics-master\sdk\dgNewton -c C:\Users\\Desktop\ogl-master\common\texture.cpp -o obj\Debug\common\texture.o
g++.exe -Wall -g -IC:\Users\\Desktop\ogl-master\common -IC:\Users\\Desktop\ogl-master\external\glm-0.9.7.1 -IC:\msys64\mingw64\include\GL -IC:\msys64\mingw64\include -IC:\newton-dynamics-master\sdk\dgNewton -c C:\Users\\Desktop\ogl-master\tutorial07_model_loading\tutorial07.cpp -o obj\Debug\tutorial07.o
g++.exe -LC:\msys64\mingw64\lib -o bin\Debug\tuto7.exe obj\Debug\common\controls.o obj\Debug\common\objloader.o obj\Debug\common\texture.o obj\Debug\tutorial07.o -lOpenGL32 -lglu32 -lfreeglut -lglew32 -lglew32mx -lglfw3dll C:\msys64\mingw64\lib\libfreeglut_static.a C:\msys64\mingw64\lib\libfreeglut.a C:\msys64\mingw64\lib\libglfw3.a
C:\Users\\Desktop\ogl-master\common\texture.cpp: In function 'GLuint loadDDS(const char*)':
C:\Users\\Desktop\ogl-master\common\texture.cpp:167:15: warning: unused variable 'components' [-Wunused-variable]
167 | unsigned int components = (fourCC == FOURCC_DXT1) ? 3 : 4;
| ^~~~~~~~~~
C:\Users\\Desktop\ogl-master\tutorial07_model_loading\tutorial07.cpp: In function 'int main()':
C:\Users\\Desktop\ogl-master\tutorial07_model_loading\tutorial07.cpp:98:7: warning: unused variable 'res' [-Wunused-variable]
98 | bool res = loadOBJ("cube.obj", vertices, uvs, normals);
| ^~~
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: obj\Debug\tutorial07.o: in function `main':
C:/Users//Desktop/ogl-master/tutorial07_model_loading/tutorial07.cpp:83: undefined reference to `LoadShaders(char const*, char const*)'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
2 error(s), 2 warning(s) (0 minute(s), 1 second(s))
I'm not buiding a library just trying to include a file. I Believed adding the instruction #include and set a path to the file was enough. That is not enough ?
In my main I have several includes. For instance :
...
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <shader.hpp>
...
for example I don't need to add the file glm.cpp in my project unlike shader.cpp
I Believed adding the instruction #include and set a path to the file was enough. That is not enough ?
The include just informs the compiler about the existence of some functions and how they expect to be called. The functions themselves are in the cpp file, so you must attach (link) the code containing the functions to your project using one of the two methods I wrote before.
I don't need to add the file glm.cpp in my project unlike shader.cpp
You don't need glm.cpp probably because you are not using the functions it contains, or they are already included in one of the libraries you are linking:
-lOpenGL32 -lglu32 -lfreeglut -lglew32 -lglew32mx -lglfw3dll C:\msys64\mingw64\lib\libfreeglut_static.a C:\msys64\mingw64\lib\libfreeglut.a C:\msys64\mingw64\lib\libglfw3.a