0

So I am currently learning how to code using C++. I am trying to get the following code to execute. The purpose of the code is to, when executed, allow the user to enter in the radius of a circle which the application will then automatically output the entered radius attached with the circumference and the area.

Below is the code:

#include<iostream>
#include<cmath>
using namespace std;

int main()
{
      float radius;
      float circumference;
      float area;

      cout << "Please enter the radius of the circle: ";
      cin >> radius;
      cout << endl;

      circumference = 2 * 3.1416 * radius;
      area = 3.1416 * radius * radius;

      cout << "Radius = " << radius << endl;
      cout << "Area = " << area << endl;
      cout << "circumference = " << circumference << endl;
} 

Whenever I executed the the program though, I get one error that reads 'fatal error LNK1169: one or more multiply defined symbols found'

If you think you could help solve this error and teach me how to avoid this error in the future, I'd greatly appreciate your help!

Thanks and have a nice day :)

Jack.

1 Answers1

7

You have not shown us your real code (as shown by the missing semicolon after using namespace std, which would have caused a compilation error), and/or your IDE is misconfigured to link some module in twice or more.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
  • Apart from the missing semi-colon, that is all the code I have. The reason why it was missing is that I had to copy that bit in separately and then put 4 spaces before each line in order for it to format properly in the question so that it would appear in the grey box. It isn't missing on the code that I have, just on the question. – BroooksyBearx Dec 11 '13 at 15:32
  • @BroooksyBearx: Or hit the "format code" button on the input box's menu. Even if we're to now take your word for it that this is your real code finally, you're going to need to tell us more about how you're building your project, and _precisely_ what the output is. – Lightness Races in Orbit Dec 11 '13 at 15:33
  • I am in the learning stages of coding. The way you come across though, you're making it sound as if I'm lying about the code I've posted in saying 'even if we're to now take your word for it that this is your real code'. If there was more code to it, I would of pasted it. Surely you don't think I would hinder my chances of help by lying about what code I have and just pasting a small portion of it? – BroooksyBearx Dec 11 '13 at 15:41
  • @BroooksyBearx: I never intended to suggest that you were being deceitful or malicious. I never accused you of lying. The simple fact is that we have already found one typo in the code you posted, and we now have no way of knowing whether there are any more. – Lightness Races in Orbit Dec 11 '13 at 15:46