架构x86_64 mac的未定义符号
Undefined symbols for architecture x86_64 mac
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
这是错误消息。我是一个c++初学者,我用Sublime Text 3写了下面的代码。我不知道怎么处理,我的macbook没有安装Xcode。请帮助!
#include <string>
#include <iostream>
using namespace std;
bool StringContain(string &a,string &b)
{
const int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,61, 67, 71, 73, 79, 83, 89, 97, 101};
int f = 1;
for (int i = 0; i < a.length(); ++i)
{
int x = p[a[i] - 'A'];
if (f % x)
{
f *= x;
}
}
for (int i = 0; i < b.length(); ++i)
{
int x = p[b[i] - 'A'];
if (f % x)
{
return false;
}
}
return true;
}
您需要一个main
函数,这是您的可执行文件的入口点。
#include <string>
#include <iostream>
using namespace std;
bool StringContain(string &a,string &b)
{
const int p[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,61, 67, 71, 73, 79, 83, 89, 97, 101};
int f = 1;
for (int i = 0; i < a.length(); ++i)
{
int x = p[a[i] - 'A'];
if (f % x)
{
f *= x;
}
}
for (int i = 0; i < b.length(); ++i)
{
int x = p[b[i] - 'A'];
if (f % x)
{
return false;
}
}
return true;
}
int main()
{
return 0;
}
如果您试图构建一个独立的对象,您需要检查编译它的行。
相关文章:
- vscode g++链路故障:体系结构x86_64的未定义符号
- 体系结构x86_64的未定义符号:std:terminate(),typeinfo,运算符delete[],运算符new
- C++ 中 dlsym 的未定义符号
- 仅在 MacOS 上析构函数的未定义符号
- OSX clang++:用于 cpp 文件中显式实例化模板的体系结构x86_64的未定义符号
- PCL 出错:体系结构x86_64 @pcl的未定义符号
- clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) - 体系结构的未定义符号 x86_64:
- 体系结构x86_64的未定义符号:链接器错误
- C++ std::vector<int> 体系结构的未定义符号 x86_64:
- 生成文件:体系结构x86_64的未定义符号
- libc++abi未定义符号:_ZTVN10__cxxabif120__si-class_type_infoE
- Xcode"体系结构x86_64的未定义符号"
- 体系结构x86_64的未定义符号:找不到原因
- SWIG链接器:未定义符号:_ZN2cv8fastFreeEPv(cv::fastFree(void*))
- 如何修复架构x86_64的未定义符号,Boost Asio 1.58
- 在Qt5上去静态库:架构的未定义符号x86_64:
- 体系结构x86_64的未定义符号:c++/ h 文件和 cpp 文件
- 监视 SDK 下的未定义符号"__Unwind_SjLj_Unregister"
- 使用 Boost/Python 的未定义符号 - 复杂
- 建筑x86_64的未定义符号:"vtkDebugLeaksManager::vtkDebugLeaksManager()",引用自: