0

Now I don't know much about Xcode IDE but i am learning to use it and also learning c++ trying out a c++ function prototyping example and get the error link command failed with error code 1 tried googling it and mostly found references to specific development environment like say ipadmini, iOXetc.

Why this error after running other c++ codes on Xcode without issues.

Here is the code I am using just in case I am doing it wrong:

 //
//  main.cpp
//  c-test3
//
//  Created by george on 04/07/2016.
//  Copyright © 2016 george. All rights reserved.
//  Demonstrates the use of function prototypes
//

typedef unsigned short USHORT;
#include <iostream>
using namespace std;



USHORT FindArea(USHORT length, USHORT width); //function prototype

int main(int argc, const char * argv[]) {
    // insert code here...
    USHORT lengthOfYard;
    USHORT widthOfYard;
    USHORT areaOfYard;


    cout << "\nHow wide is your yard? ";
    cin >> widthOfYard;
    cout << "\nHow long is your yard> ";
    cin >> lengthOfYard;

    areaOfYard = FindArea(lengthOfYard, widthOfYard);

    cout << "\nYour yard is ";
    cout << areaOfYard;
    cout << " square feet\n\n";
    return 0;
}
Baum mit Augen
  • 49,044
  • 25
  • 144
  • 182
George Udosen
  • 906
  • 1
  • 13
  • 28
  • 1
    `FindArea()` is actually defined where? – πάντα ῥεῖ Jul 04 '16 at 17:53
  • Thanks for this reply, It was the solution. @Baum, As for the duplicate question part, i disagree my question was based on an `error message` I received from compilation which made no reference to the the situation explained in that link. I am learning `c++` so might or don't know what certain things actually mean. I know linker link libraries to compiled code but i felt I was missing a library not knowing it could have was an undefined function` . Thanks again for the reply I got from the user who I can't write his name as it is written in a language I don't know. – George Udosen Jul 04 '16 at 18:22

0 Answers0