“Multiple definition of” C++ compiler error

Why do you #include lines.cpp in ThreeD.cpp? This is very unusual.

Your makefile wants lines.o, so you’re going to compile lines.cpp. Anything defined in lines.cpp will be in lines.o and also in ThreeD.o.

There is an intriguing comment in lines.cpp:

Don't forget to put declarations in your .h files. 

I think the instructor wants you to break lines.cpp into a .h and a .cpp.

Excerpt from lines.cpp:

/* These go in your .h file or in lines.h */
/*

Line drawing header.

*/


void draw_line(float, float, float, float);
int near_far_clip(float, float, float *, float *, float *, float *,
                  float *, float *);

I suspect that these two declarations are the only thing that should be in lines.h.

Leave a Comment