I recently tried to build ReZound (a lightweight Linux audio editor) using GCC 4.9.3, which failed miserably and output the medley of errors shown below.
To make sure it wasn't my GCC installation that was the culprit, I also tested LLVM 3.6.2 - which emitted very similar errors - and then to be 100% certain I tried GCC 4.8.4 on a completely different machine, which produced the same errors as 4.9.3.
ReZound was last updated in 2013, so it's reasonably recent; I'm hoping this will mean the necessary modifications will be trivial enough for someone who has no working knowledge of C++ :)
I'm interested to know:
Here's what GCC 4.9.4 spits out, from a completely stock ./configure
run:
$ make
Making all in src
make[1]: Entering directory `/storage3/rezound-0.12.3beta/src'
Making all in misc
make[2]: Entering directory `/storage3/rezound-0.12.3beta/src/misc'
Making all in CNestedDataFile
make[3]: Entering directory `/storage3/rezound-0.12.3beta/src/misc/CNestedDataFile'
if /bin/sh ../../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../../config -I../../../src/misc -I../../../src/misc/missing/generated -I../../../src/PoolFile -g -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused -MT CNestedDataFile.lo -MD -MP -MF ".deps/CNestedDataFile.Tpo" \
-c -o CNestedDataFile.lo `test -f 'CNestedDataFile.cpp' || echo './'`CNestedDataFile.cpp; \
then mv -f ".deps/CNestedDataFile.Tpo" ".deps/CNestedDataFile.Plo"; \
else rm -f ".deps/CNestedDataFile.Tpo"; exit 1; \
fi
g++ -DHAVE_CONFIG_H -I. -I. -I../../../config -I../../../src/misc -I../../../src/misc/missing/generated -I../../../src/PoolFile -g -Wall -Wno-unused-function -Wno-unused-variable -Wno-unused -MT CNestedDataFile.lo -MD -MP -MF .deps/CNestedDataFile.Tpo -c CNestedDataFile.cpp -o CNestedDataFile.o
CNestedDataFile.cpp:21:2: warning: #warning parseFile doesnt need to set the filename, only the constructor and setFilename should do that [-Wcpp]
#warning parseFile doesnt need to set the filename, only the constructor and setFilename should do that
^
CNestedDataFile.cpp:22:2: warning: #warning see about retaining the order that things were parsed in the file [-Wcpp]
#warning see about retaining the order that things were parsed in the file
^
In file included from CNestedDataFile.h:31:0,
from CNestedDataFile.cpp:36:
../../../src/misc/CMutex.h:157:2: warning: access declarations are deprecated in favour of using-declarations; suggestion: add the 'using' keyword [-Wdeprecated]
CMutexLocker::didLock;
^
In file included from CNestedDataFile.h:163:0,
from CNestedDataFile.cpp:36:
anytype.h:70:12: error: explicit template specialization cannot have a storage class
template<> static const string string_to_anytype<string>(const string &str,string &ret) { return s2at::unescape_chars(s2at::remove_surrounding_quotes(str)); }
^
anytype.h:72:12: error: explicit template specialization cannot have a storage class
template<> static const bool string_to_anytype<bool>(const string &str,bool &ret) { return s2at::remove_surrounding_quotes(str)=="true" ? ret=true : ret=false; }
^
anytype.h:74:12: error: explicit template specialization cannot have a storage class
template<> static const char string_to_anytype<char>(const string &str,char &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:75:12: error: explicit template specialization cannot have a storage class
template<> static const unsigned char string_to_anytype<unsigned char>(const string &str,unsigned char &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:77:12: error: explicit template specialization cannot have a storage class
template<> static const short string_to_anytype<short>(const string &str,short &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:78:12: error: explicit template specialization cannot have a storage class
template<> static const unsigned short string_to_anytype<unsigned short>(const string &str,unsigned short &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:80:12: error: explicit template specialization cannot have a storage class
template<> static const int string_to_anytype<int>(const string &str,int &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:81:12: error: explicit template specialization cannot have a storage class
template<> static const unsigned int string_to_anytype<unsigned int>(const string &str,unsigned int &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:83:12: error: explicit template specialization cannot have a storage class
template<> static const long string_to_anytype<long>(const string &str,long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:84:12: error: explicit template specialization cannot have a storage class
template<> static const unsigned long string_to_anytype<unsigned long>(const string &str,unsigned long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:86:12: error: explicit template specialization cannot have a storage class
template<> static const long long string_to_anytype<long long>(const string &str,long long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:87:12: error: explicit template specialization cannot have a storage class
template<> static const unsigned long long string_to_anytype<unsigned long long>(const string &str,unsigned long long &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0; ss >> ret; return ret; }
^
anytype.h:89:12: error: explicit template specialization cannot have a storage class
template<> static const float string_to_anytype<float>(const string &str,float &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0f; ss >> ret; return ret; }
^
anytype.h:90:12: error: explicit template specialization cannot have a storage class
template<> static const double string_to_anytype<double>(const string &str,double &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
^
anytype.h:91:12: error: explicit template specialization cannot have a storage class
template<> static const long double string_to_anytype<long double>(const string &str,long double &ret) { istringstream ss(s2at::remove_surrounding_quotes(str)); NO_LOCALE(ss) ret=0.0; ss >> ret; return ret; }
^
In file included from CNestedDataFile.h:163:0,
from CNestedDataFile.cpp:36:
anytype.h:122:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<string>(const string &any) { return "\""+s2at::escape_chars(any)+"\""; }
^
In file included from CNestedDataFile.h:163:0,
from CNestedDataFile.cpp:36:
anytype.h:124:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<bool>(const bool &any) { return any ? "true" : "false"; }
^
anytype.h:126:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<char>(const char &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:127:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<unsigned char>(const unsigned char &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:129:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<short>(const short &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:130:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<unsigned short>(const unsigned short &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:132:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<int>(const int &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:133:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<unsigned int>(const unsigned int &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:135:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<long>(const long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:136:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<unsigned long>(const unsigned long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:138:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<long long>(const long long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
anytype.h:139:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<unsigned long long>(const unsigned long long &any) { ostringstream ss; NO_LOCALE(ss) ss << any; return ss.str(); }
^
In file included from CNestedDataFile.h:163:0,
from CNestedDataFile.cpp:36:
anytype.h:144:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<float>(const float &any) { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
^
anytype.h:145:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<double>(const double &any) { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
^
anytype.h:146:12: error: explicit template specialization cannot have a storage class
template<> static const string anytype_to_string<long double>(const long double &any) { if(isnan(any)) return "0"; else { ostringstream ss; NO_LOCALE(ss) if(any>999999.0) {ss.setf(ios::scientific); ss.width(0); ss.precision(12); ss.fill(' '); } else {ss.setf(ios::fixed); ss.precision(6); ss.fill(' '); } ss << any; return istring(ss.str()).trim(); } }
^
make[3]: *** [CNestedDataFile.lo] Error 1
make[3]: Leaving directory `/storage3/rezound-0.12.3beta/src/misc/CNestedDataFile'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/storage3/rezound-0.12.3beta/src/misc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/storage3/rezound-0.12.3beta/src'
make: *** [all-recursive] Error 1
As the error message says, static
cannot be applied to top-level templates. In fact, the most recent commit to the code explicitly removed the static
(via the STATIC_TPL
macro) on clang and on gcc 4.3 and above.
tl;dr: Update your code to the latest version of ReZound. You may have to get the code from Subversion trunk.