I can't seem to get rid of these seemingly random compiles errors in one of my classes. I get about 4 errors such as:
multiple definition of `draw_line(float, float, float, float)'
and
multiple definition of `near_far_clip(float, float, float*, float*, float*, float*, float*, float*)'
that are flagged in the middle of the method.
I also consistently get "multiple definition of `stack'" in the middle another method. stack is a global variable in a totally different file. It isn't even mentioned in the file I'm getting the error in.
I tried separating the error prone file into .h and .cpp files (was originally just a .cpp) and nothing about the error changed...
I don't have duplicated methods. I only have one #include of lines.h and there is an ifndef clause at the beginning. All these errors appear in the .cpp file.
Any ideas what it could be?
Alright I got the code up:
http://code.bulix.org/wrmmiw-70109 ---------lines.cpp
http://code.bulix.org/l2milw-70110 ---------ThreeD.cpp
http://code.bulix.org/e50rga-70111 ----------ThreeD.h
http://code.bulix.org/3ctuqy-70112 ----------makefile
The lines.cpp is a converted .c file I received from my instructor. I included the makefile just in case, because I always have problems with it. I also annotated exactly where the errors were flagged in the file, but they seem pretty random so I don't know if it's particularly important. I abandoned the .h file because it wasn't solving anything or helping. I believe it will be easier to find the mistake without it.
Here is also the requested main.cpp file (there is no .h)
http://code.bulix.org/9img79-70113
I remade the lines.h file due to and I'm still receiving the:
multiple definition of draw_line(float, float, float, float)'
and
multiple definition of
near_far_clip(float, float, float*, float*, float*, float*, float*, float*)'
errors in the lines.cpp file, but the "multiple definition of `stack'" error is now in a random place in the ThreeD.cpp file (and is marked by a comment now) ^This error has been fixed and the files have been revised to show this
Updated files: http://code.bulix.org/pl0ha3-70114 -------------lines.h
http://code.bulix.org/en2iiq-70124 -------------lines.cpp
http://code.bulix.org/ec1l4c-70125 -------------ThreeD.cpp
http://code.bulix.org/cm691a-70117 ------------ThreeD.h
I appreciate the help greatly. I messed around with labeling some the global variables extern, but it didn't seem to affect anything.