【发布时间】:2013-12-23 19:32:04
【问题描述】:
我有以下代码:
class employee {
public:
static int last_id;
...
};
int main() {
employee::last_id=0;
}
当我尝试运行它时,它会给出以下错误:
Undefined symbols for architecture x86_64:
"employee::last_id", referenced from:
_main in chap7-F3IpS1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Finished in 0.3s with exit code 1]
【问题讨论】:
-
应该用谷歌搜索这个。我记得遇到了这个错误。当我用谷歌搜索时,前 10 个左右的结果指向 Stack Overflow。难怪我可以在不发布另一个副本的情况下解决这个问题。