在Mac 10.5 SDK中使用STL

时间:2012-03-28 06:23:56

标签: xcode stl artoolkit

希望这与StackOverflow比mac.stackexchange ...

更相关

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

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

我可以使用任何类型的包装器或解决方法吗?我基本上编译直接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

2 个答案:

答案 0 :(得分:0)

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

除此之外,执行#include <vector>应该没有任何问题。

答案 1 :(得分:0)

基本上,必须在幕后完成一些技巧。 我不得不更新我的本地SDK(事实证明,ARToolkit确实支持更新版本,无论他们的文档是什么),然后STL库工作。