【发布时间】:2013-11-06 12:06:01
【问题描述】:
我创建了一个简单的类,其中包含头文件 (.h)、类实现文件 (.cpp) 和主文件 (.cpp)。
在我尝试在 x 代码中链接(构建)出现此错误之前似乎没有错误:
架构 x86_64 的未定义符号:
“bbq::bbq(std::__1::basic_string, std::__1::allocator >, std::__1::basic_string, std::__1::allocator >)”,引用自: _main in main.o
ld:未找到架构 x86_64 的符号
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)*
这是我的代码:
int main()
{
bbq barbeque ("coleman", "101a");
barbeque.loadCoals(); // print output
头文件:
class bbq
{
private:
string brand, model;
public:
bbq (string brand, string model);
void loadCoals();}
以及函数定义:
void bbq::loadCoals()
{
cout<<"Loading Coleman Grill 101A with coals!";
}
【问题讨论】:
标签: c++ xcode class hyperlink header