但願這不是mac.stackexchange更相關的StackOverflow ...使用STL
我使用的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
爲什麼不能包含STL頭文件?當你做什麼時會發生什麼? – 2012-03-28 06:42:05
STL是C++標準庫的一部分。如果你正在編譯的是「基本上直的C代碼」,也許這可能是你的問題? ;) – jalf 2012-03-28 07:38:44
真的......我希望我能以某種方式將編譯器切換到C++(目前只有選項是LLVM GCC 4.2和Apple LLVM編譯器3.0)。 – espais 2012-03-28 13:46:51