简体   繁体   中英

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.

您尚未向我们展示您的真实代码(如using namespace std后丢失的分号所示, 这会导致编译错误 ),和/或您的IDE配置错误,无法两次或多次链接某个模块。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM