c++ - mac osx 上未找到架构 x86_64 错误的符号

标签 c++ macos eclipse-luna

我目前正在学习 C++ 类(class)。我在 MAC OSX 上使用 Eclipse Luna。我不确定这个错误消息。 Snap of Error Message 什么可能导致编译错误?

该代码只是为果汁机设计一个支付系统。

谢谢。

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

}

最佳答案

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

并且还添加string header 。

关于c++ - mac osx 上未找到架构 x86_64 错误的符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39439948/

相关文章:

c++ - 如何添加公开课?

c++ - 尝试读取 9 到 13 之间的无符号字符时,ifstream 的行为非常奇怪

Objective-c 我应该删除观察 NSWindowWillCloseNotification 吗?

eclipse - 使用 pom 将 Maven 输出发送到控制台和日志文件

java - 开发环境 : e(fx)clipse not working properly

java - 在 eclipse 中安装了深色主题,但滚动条仍然是灰色的

C++:使用 boost lambda 获取 std::tr1::unordered_map 中的最大值

c++ - 螺旋迭代

swift - 在 mac OS 上使用 swift 4 拖放

python - pylab.scatter 创建带有奇怪白线的颜色条