Search code examples
c++macoseclipse-luna

symbol(s) not found for architecture x86_64 error on mac osx


I am currently studying classes in C++. I am using Eclipse Luna on a MAC OSX. I am unsure about this error message.Snap of Error Message What could be causing the compilation error?

The code is simply designing a payment system for a juice dispenser.

Thank you.

#include <iostream>
#include <string>
using namespace std;

void disProduct (string);

int main ()
{
int choice;
string orange, apple, mango, strawberryBanana;

cout << "1 for orange juice \n"
     << "2 for apple juice \n"
     << "3 for mango juice \n"
     << "4 for strawberry-banana juice \n"
     << "9 to exit \n";

cin >> choice;

switch(choice)
{
    case 1:disProduct(orange);
            break;
    case 2:disProduct(apple);
            break;
    case 3:disProduct(mango);
            break;
    case 4:disProduct(strawberryBanana);
            break;
}

return 0;
}

void dispProduct (string name)
{
int vend;
cout << "please enter 50 cents";
cin >> vend;

while (vend > 0)
{
    if(vend < 50)
        {
        cout << "Please enter the remaining amount of " << 50-   vend;
        }

    if (vend >= 50)
        {
        cout << "please take your "<< name <<"juice and change
    << in the     amount of " << vend - 50;
        }
}

}

Solution

  • Declared function prototype is void disProduct (string); but the actual definition is void dispProduct (string name) and both the names are not same.

    And also add string header too.