Xcode 错误"not found for architecture" 。尝试不使用库的基本C++
Xcode error "not found for architecture". trying basic C++ w/o libraries
我看到了很多关于这个"not found for architecture"的错误,但我还没有从阅读其他一些帖子中找到解决方案…(在我看来,他们大多数都专注于库链接,但我不认为我在使用任何库…)
我正在尝试做非常基本的c++东西,基本上只是传递一个对象到另一个类中的另一个函数。我是c++的初学者,主要来自Java,所以我甚至不完全确定是我写错了代码还是IDE的问题…
我的代码:
class One{
public:
One();
int value;
};
One::One(){
value = 5;
}
class Two{
public:
Two();
One one;
int doSomething(One* oneArgument);
int somethingThatCallsDoSomething();
};
int Two::doSomething(One *oneArgument){
return oneArgument->value;
}
int Two::somethingThatCallsDoSomething(){
doSomething(&one);
return 0;
}
int main(){
Two two;
return two.somethingThatCallsDoSomething();
}
我的错误是,我得到一个'构建失败'与两个错误:
架构x86_64的未定义符号:"Two::Two()",引用自:_main in main. 0没有找到架构x86_64的Ld:符号Clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
这是上面的附加文本(我不知道它是关于什么的…):
Ld/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/Build/Products/Debug/try 更 简单 版本 issue。app/Contents/MacOS/attempt for 甚至 简单 版本 issue normal x86_64cd"/Users/Nafty/Documents/Philosophy/experiment 1 with Xcode/SDL2.0 w/attempt for even simple version of issue"出口MACOSX_DEPLOYMENT_TARGET = 10.9/应用程序/xcode/内容/开发/工具链/XcodeDefault。xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/sdk/MacOSX10.9。sdk -L/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/Build/Products/Debug -L/opt/local/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/sdk/MacOSX10.9。sdk/usr/lib -F/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/Build/Products/Debug -F/Library/Frameworks -filelist/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/Build/Intermediates/尝试 更 简单 版本 issue。构建/调试/尝试 更 简单 版本 问题。build/Objects-normal/x86_64/attempt for even version of issueLinkFileList -mmacosx-version-min=10.9 -framework cocoa -framework SDL2 -stdlib=libc++ -Xlinker -dependency_info -Xlinker/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/Build/Intermediates/attempt for 更 简单版本 issue构建/调试/尝试 更 简单 版本 问题。- 0/Users/Nafty/Library/Developer/Xcode/DerivedData/attempt_for_even_simpler_version_of_issue-gjurwihlodxqbjgukkxvnrjxcmti/build/Products/Debug/attempt for even simple version of issue. datapp/Contents/MacOS/attempt for even version of issue
我从2012年11月开始在Macbook Pro视网膜显示器13"上运行Xcode 5.1.1
这个问题是非常令人沮丧的b/c我甚至不能通过基本的编程的东西进步…
非常感谢你的帮助!
丹
您省略了类2默认构造函数。您可以将它添加到类定义
class Two{
public:
Two() {}
One one;
int doSomething(One* oneArgument);
int somethingThatCallsDoSomething();
};
或其他地方(像你的其他方法)
Two::Two(){
//Some constructor code here
}
- OpenCV Android C++ imwrite not found
- 解决"ld: library not found for -ltensorflow_framework.2.3.0"
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- 处理"no operator found"
- C++初学者:为什么我的编译器根据我的循环返回"name not found"?
- _BitScanForward64 can not be found
- 使用提升 asio 时出现"resolve: Host not found (authoritative)"异常
- 为什么 VScode 在 .h 文件中显示"'iostream' file not found"?
- 使用自定义 nodejs 插件时的"The specified module could not be found"
- Boost.Python 和导入 dll,"The specified module could not be found"
- 为什么我在" 'X' identifier not found' "上收到错误
- WinDBG适用于从Visual Studio 2015保存的转储,但不适用于任务管理器。显示异常代码"not found"
- "Entry Point Not Found" Azure 中的错误 LightGBM R 包
- TBB_tbb_LIBRARY_DEBUG-NOT FOUND
- 当索引为 1 时,_BitScanReverse返回 0,这意味着根据 MS "no set bits were found"
- 为什么即使我定义了它们"no matching overload found"也会出现错误
- Android Studio 3.1.2 - 无法运行C++子例程"No implementation found for Java.lang.String..."
- 在 Ubuntu 16.04 下运行协程示例会得到"'experimental/coroutine' file not found"
- 在 mongodb c++ 驱动程序中使用声明"not found"
- 如何修复"/bin/sh: bc: command not found"