Amber Roxanna
Amber Roxanna

Reputation: 1695

embedded function using ofstream

I'm having trouble executing my program due to the following error message: undefined reference to 'typeOfTriangle(int*, std::basic_ofstream<char, std::char_traits<char> >&)'

void classify(int sides[], ofstream &outfile)
{

  int largest(int []);
  void typeOfTriangle(int [], ofstream &);
  bool isRightTriangle(int []);

  outfile << "Largest Sides: " << largest(sides) << endl;
  typeOfTriangle(sides,outfile);

  if(isRightTriangle(sides))
      outfile << "Right Triangle\n";
  else
      outfile << "Not a right triangle\n";
}

Upvotes: 0

Views: 155

Answers (2)

Borgleader
Borgleader

Reputation: 15916

void typeOfTriange(int sides[], ofstream &outfile)
{
    //..
}

According to your comment this is your definition for the function which doesnt match your forward declaration. You forgot an l in Triangle.

Upvotes: 1

dieram3
dieram3

Reputation: 591

it's a linker error, either you have not defined typeOfTriangle, or you have not linked all of your object files.

Upvotes: 1

Related Questions