MAC osx上的架构x86_64错误没有找到符号

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

本文关键字:错误 符号 osx x86 MAC      更新时间:2023-10-16

我目前正在学习c++课程。我在MAC OSX上使用Eclipse Luna。我不确定这个错误信息。错误信息的捕捉什么可能导致编译错误?

代码只是设计了一个果汁自动售货机的支付系统。

谢谢。

#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;
        }
}
}

声明的函数原型是void disProduct (string);,但实际定义是void dispProduct (string name),并且两者的名称不相同。

和也添加string头太