I have a problem when I try to compile my program. Do not think it's the code. Create a project so Xcode gives me the main code, it I'm not using, instead create a new file called Triangulo.cpp, I just want to compile this file to see if it works.
This is the text that appears after trying to compile.
Ld /Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Products/Debug/Poligonos\ 2D normal x86_64
cd "/Users/oscarespinosa/Documents/Ingenieria Aeronautica/2do Semestre/Programacion Orientada a Objetos/Poligonos 2D"
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Products/Debug -F/Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Products/Debug -filelist /Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Intermediates/Poligonos\ 2D.build/Debug/Poligonos\ 2D.build/Objects-normal/x86_64/Poligonos\ 2D.LinkFileList -mmacosx-version-min=10.10 -stdlib=libc++ -Xlinker -dependency_info -Xlinker /Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Intermediates/Poligonos\ 2D.build/Debug/Poligonos\ 2D.build/Objects-normal/x86_64/Poligonos\ 2D_dependency_info.dat -o /Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Products/Debug/Poligonos\ 2D
duplicate symbol _main in:
/Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Intermediates/Poligonos 2D.build/Debug/Poligonos 2D.build/Objects-normal/x86_64/main.o
/Users/oscarespinosa/Library/Developer/Xcode/DerivedData/Poligonos_2D-folpbuxmhfipkuadwfzchugbzton/Build/Intermediates/Poligonos 2D.build/Debug/Poligonos 2D.build/Objects-normal/x86_64/Triangulo.o
ld: 1 duplicate symbol for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here is the code:
//
// Triangulo.cpp
// Poligonos 2D
//
// Created by Oscar Espinosa on 4/6/15.
// Copyright (c) 2015 IPN ESIME Ticoman. All rights reserved.
//
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int b, h;
float c, a, area, perimetro;
cout << " Calculo de area y perimetro de un triangulo rectangulo" << endl
<< "\n Ingrese el valor de la base: ";
cin >> b;
cout << "\n Ingrese el valor de la altura: ";
cin >> h;
area = (b*h)/2.00;
c = sqrt(b*b + h*h);
a = c;
perimetro = a+b+c;
cout << "\n El area es: " << area << endl
<< " El perimetro es: " << perimetro;
return 0;
}
#includeimproperly. Make sure you're not including the same class multiple times on the same document.