Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 185905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:33:12+00:00 2026-05-11T15:33:12+00:00

I can’t seem to get rid of these seemingly random compiles errors in one

  • 0

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 of 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 duplicate 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:

  • lines.cpp
  • ThreeD.cpp
  • ThreeD.h
  • 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 the requested main.cpp file (there is no .h).


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). Update: This error has been fixed and the files have been revised to show this:

  • lines.h
  • lines.cpp
  • ThreeD.cpp
  • ThreeD.h

I messed around with labeling some the global variables extern, but it didn’t seem to affect anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T15:33:13+00:00Added an answer on May 11, 2026 at 3:33 pm

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 140k
  • Answers 140k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I'm not sure what you're looking for is OAuth. OAuth… May 12, 2026 at 7:54 am
  • Editorial Team
    Editorial Team added an answer If you want to store a Java object, try with… May 12, 2026 at 7:54 am
  • Editorial Team
    Editorial Team added an answer I had a similar problem - I worked around it… May 12, 2026 at 7:54 am

Related Questions

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I am currently running into a problem where an element is coming back from
Does anyone know how can I replace this 2 symbol below from the string
I can do an eval(something()); to execute the code dynamically in JavaScript. Is there
I can't seem to find details on how to unsubscribe from ubiquity commands. The

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.