BroooksyBearx
BroooksyBearx

Reputation: 21

C++ Compiling fatal error

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.

Upvotes: 0

Views: 97

Answers (1)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385088

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.

Upvotes: 7

Related Questions