像许多其他人一样,我正在 iTunes 上学习 CS106B 课程,虽然该课程很旧,但我正在尝试使用最新的斯坦福 C++ 库。它们可以在这里找到:http: //www.stanford.edu/class/cs106b/。
在项目的构建阶段,我已将文件“random.h”和“libStanfordCPPlib.a”插入到“Link Binary with Libraries”中。当我这样做时,我收到以下错误消息:
Check dependencies
warning: skipping file '/Users/lewis/Documents/Think Like a Programmer/CS106/VotingSimulation/../../../Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/random.h' (unexpected file type 'sourcecode.c.h' in Frameworks & Libraries build phase)
ld: warning: ignoring file /Users/lewis/Documents/Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/libStanfordCPPLib.a, file was built for archive which is not the architecture being linked (x86_64): /Users/lewis/Documents/Programming Abstractions/Assignment 1/Assignment1-xcode/0 - Warmup/StanfordCPPLib/libStanfordCPPLib.a
Undefined symbols for architecture x86_64:
"randomChance(double)", referenced from:
_main 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)
我正在使用 Mac OS X 10.7.5 和 XCode 4.6.2。我已将项目和目标的构建设置基础 SDK 设置为 OS X 10.7。
在我看来,“libStanfordCPPlib.a”文件可能是一个存档文件,我必须先取消存档,然后才能链接头文件的实现代码。这是我需要做的,如果是,我该怎么做?我在链接文件时做错了什么吗?
我是一个菜鸟,如果任何人成功让当前的斯坦福 CS106B C++ 库在 XCode 4.6.2 中工作,我将不胜感激。