Closed yasirs closed 12 years ago
What's your gcc version?
I have: warmstrong@krypton:~/dvl/c++/mcmc/CppBugs/test$ g++ --version g++ (Debian 4.6.2-9) 4.6.2
When I remove 'typename' I get this:
warmstrong@krypton:~/dvl/c++/mcmc/CppBugs/test$ make linear.model.test
g++ -I.. -Wall -O2 linear.model.test.cpp -o linear.model.test -lblas -llapack
In file included from ../cppbugs/mcmc.deterministic.hpp:21:0,
from ../cppbugs/cppbugs.hpp:21,
from linear.model.test.cpp:4:
../cppbugs/mcmc.specialized.hpp: In member function ‘T cppbugs::MCMCSpecialized
This is my g++:
$ g++ --ver Using built-in specs. Target: i686-apple-darwin11 Configured with: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_lang_apple-gcc42/apple-gcc42/work/objroot/src/configure --disable-checking --prefix=/opt/local --mandir=/opt/local/share/man --enable-languages=c,c++,objc,obj-c++ --libexecdir=/opt/local/libexec/apple-gcc42 --libdir=/opt/local/lib/apple-gcc42 --includedir=/opt/local/include/apple-gcc42 --program-suffix=-apple-4.2 --with-system-zlib --disable-nls --with-gmp=/opt/local --with-mpfr=/opt/local --with-slibdir=/usr/lib --build=x86_64-apple-darwin11 --enable-werror-always --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
With the typename line (specialized.hpp:68) as
for(typename std::list<double>::const_iterator it = history.begin(); it != history.end(); it++) {
,
I get
$ make linear.model.test g++ -I.. -Wall -O2 -L/opt/local/lib -I/opt/local/include -larmadillo -llapack linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/mcmc.deterministic.hpp:21, from ../cppbugs/cppbugs.hpp:21, from linear.model.test.cpp:4: ../cppbugs/mcmc.specialized.hpp: In member function 'double cppbugs::MCMCSpecialized<double>::mean() const': ../cppbugs/mcmc.specialized.hpp:68: error: using 'typename' outside of template In file included from ../cppbugs/cppbugs.hpp:27, from linear.model.test.cpp:4: ../cppbugs/mcmc.model.hpp: In member function 'void cppbugs::MCModel::sample(int, int, int, int)': ../cppbugs/mcmc.model.hpp:137: warning: unused variable 'ideal_scale' make: *** [linear.model.test] Error 1
After changing it to
for(std::list<double>::const_iterator it = history.begin(); it != history.end(); it++) {
, I get
$ make linear.model.test g++ -I.. -Wall -O2 -L/opt/local/lib -I/opt/local/include -larmadillo -llapack linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/cppbugs.hpp:27, from linear.model.test.cpp:4: ../cppbugs/mcmc.model.hpp: In member function 'void cppbugs::MCModel::sample(int, int, int, int)': ../cppbugs/mcmc.model.hpp:137: warning: unused variable 'ideal_scale'
So I think this issue was resolved with gccc 4.6
$ make g++ -I.. -Wall -O2 -llapack linear.model.test.cpp -o linear.model.test In file included from ../cppbugs/mcmc.deterministic.hpp:21, from ../cppbugs/cppbugs.hpp:21, from linear.model.test.cpp:4: ../cppbugs/mcmc.specialized.hpp: In member function ‘double cppbugs::MCMCSpecialized<double>::mean() const’: ../cppbugs/mcmc.specialized.hpp:68: error: using ‘typename’ outside of template
error seems to be here:
for(typename std::list<double>::const_iterator it = history.begin(); it != history.end(); it++) {