【发布时间】:2015-10-22 03:35:13
【问题描述】:
Undefined symbols for architecture x86_64:
"makeHero(std::string, int)", referenced from:
makeCard() in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是我尝试在 Xcode 上编译代码时遇到的错误。我环顾四周,将架构设置更改为通用,并制作了 c++ 标准库 libstdc++,这是我在这里找到的答案。还是什么都没有:/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
我的 main.cpp 文件的开头是什么原因造成的?我将 stdlib.h 和 stdio.h 更改为没有 .h 并且找不到 stdlib 文件。
【问题讨论】:
-
您需要确定哪个库提供了名为
makeHero()和makeCard()的函数,然后确保链接这些库。所以进入Project Editor,选择你要为其添加库的Target,然后点击Build Phases和Link Binary with Libraries并添加提供makeHero()的库。
标签: c++ xcode macos osx-elcapitan