【问题标题】:I'm getting a strange error when running here在这里运行时遇到一个奇怪的错误
【发布时间】:2014-09-05 06:52:50
【问题描述】:

您好,我在运行此代码时遇到了以前从未见过的错误。实际上有 2 个错误。

这是第一个说 Apple Mach-O Linker (id) Error

“地址::setAddress(std::__1::basic_string, std::__1::allocator >, std::__1::basic_string, std::__1::allocator >, std::__1::basic_string, std: :__1::allocator >, std::__1::basic_string, std::__1::allocator >)”,引用自:

这是第二个 Apple Mach-O 链接器 (id) 错误 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我在这个程序中有多个课程,所以我将它们链接到另一个网站,而不是在这里堆积。

这是我的代码的链接 https://gist.github.com/anonymous/646f6e2166c56688f739

提前谢谢各位。

void Address::setAddress(const string street, const string city, const string state, const string zipcode) {
setStreet(street);
setCity(city);
setState(state);
setZipcode(zipcode);
}

【问题讨论】:

    标签: c++ xcode class inheritance


    【解决方案1】:

    Address中没有函数setAddress的实现,只有声明。

    void setAddress(const string street, const string city, const string state, const string zipcode);
    

    【讨论】:

    • 你会如何设置它?考虑所有不同的变量。
    • @MatthewTingle 这是你的职责。你想问什么?您从Employee::setAddress 调用此函数,但您没有实现它。
    • 我在上面的帖子中添加了 setAddress。现在构建成功了,打开了 employeesOut.txt 文件,但由于某种原因它没有写入,但完全没有错误。
    • 我会打开另一个问题,并在这里接受你的回答,除非你想在聊天中继续。
    猜你喜欢
    • 2021-11-29
    • 2016-07-03
    • 2020-01-25
    • 1970-01-01
    • 1970-01-01
    • 2012-02-20
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    相关资源
    最近更新 更多