But it was a preprocessor error so my teacher was correct. I never said the preprocessor wasn't doing what it was suppose to be doing I said there was a preprocessor error and it was, a redefinition and it's the preprocessor's job to see that. Whoever voted down is an idiot.
Preprocessor error. Yeah, right.
Let's keep the include section untouched, and try to build Triangle.cpp sans linking with the GLTools library... I'll cut you some slack and compile ..\Common\InitShader.cpp as well, since Triangle.cpp depends on it.
Guess what? THE BUILD FAILS. The object files WON'T LINK with the static libraries available for download (libfreeglut.a and libglew32.a).
-------------- Build: Debug in Triangle (compiler: GNU GCC Compiler)---------------
g++.exe -Wall -DFREEGLUT_STATIC -g -std=c++11 -m32 -I..\GLTools\include -I..\include -c C:\4mad3u5-CB\Common\InitShader.cpp -o obj\Debug\Common\InitShader.o
g++.exe -Wall -DFREEGLUT_STATIC -g -std=c++11 -m32 -I..\GLTools\include -I..\include -c C:\4mad3u5-CB\Triangle\Triangle.cpp -o obj\Debug\Triangle.o
g++.exe -o bin\Debug\Triangle.exe obj\Debug\Common\InitShader.o obj\Debug\Triangle.o -m32 ..\lib\windows\libglew32.a ..\lib\windows\libfreeglut.a -lopengl32 -lwinmm -lgdi32
In file included from ..\include/Angel.h:67:0,
from C:\4mad3u5-CB\Common\InitShader.cpp:2:
..\include/vec.h: In constructor 'Angel::vec4::vec4(const Angel::vec3&, float)':
..\include/vec.h:325:5: warning: 'Angel::vec4::w' is initialized with itself [-Winit-self]
vec4( const vec3& v, const float s = 1.0 ) : w(w)
^
obj\Debug\Common\InitShader.o: In function `ZN5Angel10InitShaderEPKcS1_':
C:/4mad3u5-CB/Common/InitShader.cpp:41: undefined reference to `_imp____glewCreateProgram'
C:/4mad3u5-CB/Common/InitShader.cpp:51: undefined reference to `_imp____glewCreateShader'
C:/4mad3u5-CB/Common/InitShader.cpp:52: undefined reference to `_imp____glewShaderSource'
C:/4mad3u5-CB/Common/InitShader.cpp:53: undefined reference to `_imp____glewCompileShader'
C:/4mad3u5-CB/Common/InitShader.cpp:56: undefined reference to `_imp____glewGetShaderiv'
C:/4mad3u5-CB/Common/InitShader.cpp:60: undefined reference to `_imp____glewGetShaderiv'
C:/4mad3u5-CB/Common/InitShader.cpp:62: undefined reference to `_imp____glewGetShaderInfoLog'
C:/4mad3u5-CB/Common/InitShader.cpp:71: undefined reference to `_imp____glewAttachShader'
C:/4mad3u5-CB/Common/InitShader.cpp:75: undefined reference to `_imp____glewLinkProgram'
C:/4mad3u5-CB/Common/InitShader.cpp:78: undefined reference to `_imp____glewGetProgramiv'
C:/4mad3u5-CB/Common/InitShader.cpp:82: undefined reference to `_imp____glewGetProgramiv'
C:/4mad3u5-CB/Common/InitShader.cpp:84: undefined reference to `_imp____glewGetProgramInfoLog'
C:/4mad3u5-CB/Common/InitShader.cpp:92: undefined reference to `_imp____glewUseProgram'
obj\Debug\Triangle.o: In function `Z7SetupRCv':
C:/4mad3u5-CB/Triangle/Triangle.cpp:29: undefined reference to `GLShaderManager::InitializeStockShaders()'
C:/4mad3u5-CB/Triangle/Triangle.cpp:37: undefined reference to `GLBatch::Begin(unsigned int, unsigned int, unsigned int)'
C:/4mad3u5-CB/Triangle/Triangle.cpp:39: undefined reference to `GLBatch::End()'
obj\Debug\Triangle.o: In function `Z11RenderScenev':
C:/4mad3u5-CB/Triangle/Triangle.cpp:52: undefined reference to `GLShaderManager::UseStockShader(GLT_STOCK_SHADER, ...)'
C:/4mad3u5-CB/Triangle/Triangle.cpp:53: undefined reference to `GLBatch::Draw()'
obj\Debug\Triangle.o: In function `main':
C:/4mad3u5-CB/Triangle/Triangle.cpp:64: undefined reference to `gltSetWorkingDirectory(char const*)'
obj\Debug\Triangle.o: In function `_tcf_0':
C:/4mad3u5-CB/Triangle/Triangle.cpp:9: undefined reference to `GLBatch::~GLBatch()'
obj\Debug\Triangle.o: In function `_tcf_1':
C:/4mad3u5-CB/Triangle/Triangle.cpp:10: undefined reference to `GLShaderManager::~GLShaderManager()'
obj\Debug\Triangle.o: In function `_static_initialization_and_destruction_0':
C:/4mad3u5-CB/Triangle/Triangle.cpp:9: undefined reference to `GLBatch::GLBatch()'
C:/4mad3u5-CB/Triangle/Triangle.cpp:10: undefined reference to `GLShaderManager::GLShaderManager()'
obj\Debug\Triangle.o: In function `ZN7GLBatch16CopyVertexData3fEPf':
C:\4mad3u5-CB\Triangle/../GLTools/include/GLBatch.h:89: undefined reference to `GLBatch::CopyVertexData3f(float (*) [3])'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 1 second(s))
24 error(s), 1 warning(s) (0 minute(s), 1 second(s))
Isn't it obvious? Even if you sorted out the order of the included headers, your program WOULD NEVER LINK. Also, the preprocessor has NO BUSINESS handling redefinitions. Think about it: when the preprocessor sees a new definition for a symbol it already parsed, what should it do, keep the old definition, or the new one? The preprocessor's job is to POINT OUT such problems, and it's YOUR JOB to avoid such USER ERRORS (hint: read about include guards and #pragma once).
Whoever downvoted you is not an idiot. YOU are an idiot. Your teacher was simply wrong, that happens. You, on the other hand, are MUCH worse than that, because even when faced with HARD EVIDENCE of your errors you insist on doing all you can to twist the facts and look like you are not clueless. NOBODY is right 100% of the time.
PLEASE take the time to thoroughly read How To Ask Questions The Smart Way. If you're the TL;DR kind of person, at the very least read the On Not Reacting Like A Loser section.