gpt4 book ai didi

c++ - 用于 Xcode 4.x 的 CS106B 库

转载 作者:搜寻专家 更新时间:2023-10-31 00:01:36 24 4
gpt4 key购买 nike

是否有适用于 CS106B 的斯坦福 C++ 库版本可用于 Xcode 4.x。iTunes U 视频已有大约 4 年历史,讲义中提到的库与 Xcode 4.x @ 10.7.3 不兼容。

我已经尝试安装 Xcode 3,但它在启动时崩溃,所以这不是一个选项。

也许那里有一些提供类似功能的等效库?

有什么建议吗?

讲座和资料可在此处获得: http://itunes.apple.com/de/course/programming-abstractions/id495054099

库在这里可用: http://see.stanford.edu/materials/icspacs106b/CS106Libs_for_Xcode.zip

#include "genlib.h"
#include "simpio.h"
#include <iostream>


int main(int argc, const char * argv[])
{
// insert code here...
std::cout << "Hello, World!\n";
return 0;
}

编译错误:

Ld /Users/user123/Library/Developer/Xcode/DerivedData/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/Build/Products/Debug/helloworld normal i386
cd "/Users/user123/Dropbox/$workspaces/Xcode/CS106B/helloworld"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -L/Users/user123/Library/Developer/Xcode/DerivedData/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/Build/Products/Debug "-L/Users/user123/Dropbox/$workspaces/Xcode/CS106B/helloworld/cs106" "-L/Users/user123/Dropbox/$workspaces/Xcode/CS106B/helloworld/StanfordCPPLib" "-L/Users/user123/Dropbox/$workspaces/Xcode/CS106B/helloworld/helloworld/cs106" -F/Users/user123/Library/Developer/Xcode/DerivedData/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/Build/Products/Debug -filelist /Users/user123/Library/Developer/Xcode/DerivedData/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/Build/Intermediates/helloworld.build/Debug/helloworld.build/Objects-normal/i386/helloworld.LinkFileList -mmacosx-version-min=10.7 -lcs106 -o /Users/user123/Library/Developer/Xcode/DerivedData/helloworld-ahlmhegbtmaasucxmbtekzjtbuha/Build/Products/Debug/helloworld

Undefined symbols for architecture i386:
"___CFConstantStringClassReference", referenced from:
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
CFString in libcs106.a(mainwrapper.o)
...
"_NSApp", referenced from:
+[Glue showAbout:] in libcs106.a(mainwrapper.o)
TerminateApp() in libcs106.a(mainwrapper.o)
+[NSBundleWithoutSpuriousErrorLog aloadNibNamed:owner:] in libcs106.a(mainwrapper.o)
_main in libcs106.a(mainwrapper.o)
-[ConsoleTextView keyDown:] in libcs106.a(ConsoleTextView.o)
+[Glue showAbout:] in libcs106.a(mainwrapper.o)
TerminateApp() in libcs106.a(mainwrapper.o)
+[NSBundleWithoutSpuriousErrorLog aloadNibNamed:owner:] in libcs106.a(mainwrapper.o)
_main in libcs106.a(mainwrapper.o)
-[ConsoleTextView keyDown:] in libcs106.a(ConsoleTextView.o)
"_objc_msgSendSuper", referenced from:
+[NSBundleWithoutSpuriousErrorLog aloadNibNamed:owner:] in libcs106.a(mainwrapper.o)
-[ConsoleTextView initWithFrame:] in libcs106.a(ConsoleTextView.o)
-[ConsoleTextView setFont:] in libcs106.a(ConsoleTextView.o)
-[ConsoleTextView dealloc] in libcs106.a(ConsoleTextView.o)
-[ConsoleTextView keyDown:] in libcs106.a(ConsoleTextView.o)
-[ConsoleTextView rangeForUserTextChange] in libcs106.a(ConsoleTextView.o)
"_CFBundleGetInfoDictionary", referenced from:
_main in libcs106.a(mainwrapper.o)
"_CFBundleCopyBundleURL", referenced from:
_main in libcs106.a(mainwrapper.o)
"_objc_msgSend", referenced from:
+[Glue applicationDidFinishLaunching:] in libcs106.a(mainwrapper.o)
+[Glue showAbout:] in libcs106.a(mainwrapper.o)
CocoaConsoleResize(int, int, int, int) in libcs106.a(mainwrapper.o)
TerminateApp() in libcs106.a(mainwrapper.o)
SetConsoleSize(int, int, int, bool) in libcs106.a(mainwrapper.o)
patched_read(void*, char*, int) in libcs106.a(mainwrapper.o)
CreateMenuWithItems(NSString*, menuitem*, int) in libcs106.a(mainwrapper.o)
...
"_CFURLCreateCopyDeletingLastPathComponent", referenced from:
_main in libcs106.a(mainwrapper.o)
"_CFURLGetFileSystemRepresentation", referenced from:
_main in libcs106.a(mainwrapper.o)
"_CFBundleGetMainBundle", referenced from:
_main in libcs106.a(mainwrapper.o)
"Main()", referenced from:
+[Glue studentMain] in libcs106.a(mainwrapper.o)
"_CFRelease", referenced from:
_main in libcs106.a(mainwrapper.o)
"_NSFileHandleDataAvailableNotification", referenced from:
-[ConsoleTextView registerForNotifications] in libcs106.a(ConsoleTextView.o)
"_NSForegroundColorAttributeName", referenced from:
-[ConsoleTextView setFont:] in libcs106.a(ConsoleTextView.o)
"_NSFontAttributeName", referenced from:
-[ConsoleTextView setFont:] in libcs106.a(ConsoleTextView.o)
+[ConsoleTextView contentSizeForPointSize:numRows:numCols:] in libcs106.a(ConsoleTextView.o)
"_NSBeep", referenced from:
-[ConsoleTextView keyDown:] in libcs106.a(ConsoleTextView.o)
"_objc_msgSend_fpret", referenced from:
+[ConsoleTextView contentSizeForPointSize:numRows:numCols:] in libcs106.a(ConsoleTextView.o)
"_objc_msgSend_stret", referenced from:
-[ConsoleTextView setPointSize:numRows:numCols:center:] in libcs106.a(ConsoleTextView.o)
+[ConsoleTextView contentSizeForPointSize:numRows:numCols:] in libcs106.a(ConsoleTextView.o)
+[ConsoleTextView createConsoleInWindow] in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSThread", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSAutoreleasePool", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSDictionary", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSString", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSMenu", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSMenuItem", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSBundle", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
.objc_class_name_NSBundleWithoutSpuriousErrorLog in libcs106.a(mainwrapper.o)
(maybe you meant: .objc_class_name_NSBundleWithoutSpuriousErrorLog)
".objc_class_name_NSApplication", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(mainwrapper.o)
".objc_class_name_NSObject", referenced from:
.objc_class_name_Glue in libcs106.a(mainwrapper.o)
".objc_class_name_NSAttributedString", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSMutableDictionary", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSFont", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSScroller", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSScreen", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSWindow", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSScrollView", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSColor", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSNotificationCenter", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSFileHandle", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSData", referenced from:
pointer-to-literal-objc-class-name in libcs106.a(ConsoleTextView.o)
".objc_class_name_NSTextView", referenced from:
.objc_class_name_ConsoleTextView in libcs106.a(ConsoleTextView.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

最佳答案

我遇到了同样的问题。解决这个问题的方法不是下载旧的 XCode(它会崩溃)或更新版本的斯坦福库(它不存在)——首选的方法是使用新的分配文件(每个文件都带有附加的必需库文件)并通过在每个文件夹中打开 xcode 项目文件直接在 XCode 4 中打开这些文件。您可以在当前类(class)网站中找到这些文件: http://www.stanford.edu/class/cs106b/

不幸的是,您无法直接获取这种格式的旧作业文件。鉴于此,您可以 1) 遵循当前类(class)网站上的新练习,或 2) 使用空白项目文件夹并稍微调整以遵循旧作业。

关于c++ - 用于 Xcode 4.x 的 CS106B 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9735639/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com