我正在尝试从https://github.com/Sami-Vuorela/aatc
编译代码我正在使用LLVMs em ++编译器进行编译:
以下是控制台错误消息:
/opt/emsdk_portable/emscripten/master/em++ -Qunused-arguments -U__STRICT_ANSI__ -Wall -fno-strict-aliasing -std=c++11 -DAS_WRITE_OPS=0 -DAS_USE_STLNAMES=1 -DAS_USE_FLOAT=0 -Iinclude/ -Iangelscript/sdk/angelscript/include/ -Iangelscript/sdk/add_on/scriptbuilder/ -Iangelscript/sdk/add_on/contextmgr/ -Iangelscript/sdk/add_on/scripthelper/ -Iangelscript/sdk/add_on/scriptany/ -Iangelscript/sdk/add_on/scriptstdstring/ -Iangelscript/sdk/add_on/scriptdictionary/ -Iangelscript/sdk/add_on/scriptarray/ -Iangelscript/sdk/add_on/scriptmath/ -Iangelscript/sdk/add_on/scriptgrid/ -c aatc/source/aatc_registration_tempspecs.cpp -o aatc/source/aatc_registration_tempspecs.o
In file included from aatc/source/aatc_registration_tempspecs.cpp:40:
In file included from aatc/source/aatc_tempspecs.hpp:37:
aatc/source/aatc_shared_tempspec.hpp:52:11: error: expected a qualified name after 'typename'
typename typedef T_container::iterator iteratortype;
^
aatc/source/aatc_shared_tempspec.hpp:52:11: error: expected member name or ';' after declaration specifiers
typename typedef T_container::iterator iteratortype;
^
aatc/source/aatc_shared_tempspec.hpp:97:18: error: cannot specialize a function 'Push_Back' within class scope
template<> void Push_Back<aatc_Y>(const T_content& value){
^
aatc/source/aatc_shared_tempspec.hpp:101:18: error: cannot specialize a function 'Pop_Back' within class scope
template<> void Pop_Back<aatc_Y>(){
^
aatc/source/aatc_shared_tempspec.hpp:106:25: error: cannot specialize a function 'Register_func_back_write' within
class scope
template<> static void Register_func_back_write<aatc_Y>(asIScriptEngine* engine, int& r, char* text...
^
aatc/source/aatc_shared_tempspec.hpp:114:24: error: cannot specialize a function 'Back' within class scope
template<> T_content& Back<aatc_Y>(){
^
aatc/source/aatc_shared_tempspec.hpp:119:25: error: cannot specialize a function 'Register_func_back_read' within
class scope
template<> static void Register_func_back_read<aatc_Y>(asIScriptEngine* engine, int& r, char* textb...
^
aatc/source/aatc_shared_tempspec.hpp:126:18: error: cannot specialize a function 'Push_Front' within class scope
template<> void Push_Front<aatc_Y>(const T_content& value){
^
aatc/source/aatc_shared_tempspec.hpp:130:18: error: cannot specialize a function 'Pop_Front' within class scope
template<> void Pop_Front<aatc_Y>(){
^
aatc/source/aatc_shared_tempspec.hpp:135:25: error: cannot specialize a function 'Register_func_front_write' within
class scope
template<> static void Register_func_front_write<aatc_Y>(asIScriptEngine* engine, int& r, char* tex...
^
aatc/source/aatc_shared_tempspec.hpp:143:24: error: cannot specialize a function 'Front' within class scope
template<> T_content& Front<aatc_Y>(){
^
aatc/source/aatc_shared_tempspec.hpp:148:25: error: cannot specialize a function 'Register_func_front_read' within
class scope
template<> static void Register_func_front_read<aatc_Y>(asIScriptEngine* engine, int& r, char* text...
^
aatc/source/aatc_shared_tempspec.hpp:167:18: error: cannot specialize a function 'Erase_value' within class scope
template<> void Erase_value<aatc_Y>(const T_content& value){
^
aatc/source/aatc_shared_tempspec.hpp:172:25: error: cannot specialize a function 'Register_func_erase_value' within
class scope
template<> static void Register_func_erase_value<aatc_Y>(asIScriptEngine* engine, int& r, char* tex...
^
aatc/source/aatc_shared_tempspec.hpp:180:24: error: cannot specialize a function 'op_index' within class scope
template<> T_content& op_index<aatc_Y>(aatc_type_sizetype index){
^
aatc/source/aatc_shared_tempspec.hpp:186:25: error: cannot specialize a function 'Register_func_op_index' within
class scope
template<> static void Register_func_op_index<aatc_Y>(asIScriptEngine* engine, int& r, char* textbu...
^
aatc/source/aatc_shared_tempspec.hpp:192:18: error: cannot specialize a function 'Reserve' within class scope
template<> void Reserve<aatc_Y>(aatc_type_sizetype count){
^
aatc/source/aatc_shared_tempspec.hpp:197:25: error: cannot specialize a function 'Register_func_reserve' within
class scope
template<> static void Register_func_reserve<aatc_Y>(asIScriptEngine* engine, int& r, char* textbuf...
^
aatc/source/aatc_shared_tempspec.hpp:203:18: error: cannot specialize a function 'Insert' within class scope
template<> void Insert<aatc_Y>(const T_content& value){
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
我该如何解决这个问题?
答案 0 :(得分:5)
typename
和typedef
的顺序相反,应为:
typedef typename T_container::iterator iteratortype;
那是因为typename
装饰了限定名T_container::iterator
,整个装饰的东西是typedef
的主题。
其他主机错误非常明显:代码显然包含在类中声明的模板特化,这不是合法的C ++。所以不要这样:
class X
{
template <class T>
void Erase_value(const T_content& value);
template <>
void Erase_value<aatc_Y>(const T_content& value){ /* ... */ }
};
必须是这样的:
class X
{
template <class T>
void Erase_value(const T_content& value);
};
template <>
void X::Erase_value<aatc_Y>(const T_content& value){ /* ... */ }