0

希望这比 mac.stackexchange 与 StackOverflow 更相关......

我正在将 ARToolkit 用于增强现实项目,为了使其在 Mac 下工作,我需要运行 10.5 SDK。

我的问题是我似乎无法包含任何 STL 头文件……尤其是向量。

我可以使用任何类型的包装器或解决方法吗?我基本上是在编译直接的 C 代码,并且想利用 STL 框架的一些更好的特性来加速开发......


编辑:

仔细观察,ARToolkit 似乎在其包含路径中的某个点包含了 std_vector。

错误片段:

Bits/c++allocator.h: No such file or directory
Expected template-name before '<' token
Expected `{' before '<' token
Expected unqualified-id before '<' token
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/iosfwd
Bits/c++locale.h: No such file or directory
Bits/c++io.h: No such file or directory
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_algobase.h
Bits/c++config.h: No such file or directory
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_vector.h
Expected type-specifier before 'allocator'
Expected '>' before 'allocator'
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
'input_iterator_tag' has not been declared
'forward_iterator_tag' has not been declared
There are no arguments to '__N' that depend on a template parameter, so a declaration of '__N' must be available
(if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
Expected nested-name-specifier before 'iterator_traits'
Expected initializer before '<' token
There are no arguments to '_IterCategory' that depend on a template parameter, so a declaration of '_IterCategory' must be available
/Users/espais/research/artoolkit/trunk/artoolkit/examples/newproject/newproject.cpp
Expected `}' at end of input
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.2.1/bits/stl_bvector.h
Expected template-name before '<' token
Expected `{' before '<' token
Expected unqualified-id before '<' token
4

2 回答 2

0

您可能需要将文件设为.mm文件 (Objective-C++) 而不是.m(Objective-C)。

除此之外,应该不会有任何麻烦#include <vector>

于 2012-03-28T06:43:55.343 回答
0

基本上,有一些诡计必须在幕后完成。我不得不更新我的本地 SDK(事实证明 ARToolkit 确实支持更新的版本,不管他们的文档说什么),然后 STL 库就可以工作了。

于 2012-07-06T18:58:56.377 回答