Chapter 10 code compiled successfully in VC++ but NOT in g++ Linux.
Errors seem indicate that g++ does not understand STL syntax. Could you please advice how to compile the code in g++ Linux?
Thank you!
g++ version
[root@localhost chap10]# g++ -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
Errors:
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:100: error: there are no arguments to ?Size? that depend on a template parameter, so
a declaration of ?Size? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:100: note: (if you use ?-fpermissive?, G++ will accept your code, but allowing the u
se of an undeclared name is deprecated)
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:100: error: there are no arguments to ?MinIndex? that depend on a template parameter
, so a declaration of ?MinIndex? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:103: error: there are no arguments to ?MinIndex? that depend on a template parameter
, so a declaration of ?MinIndex? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:103: error: there are no arguments to ?MaxIndex? that depend on a template parameter
, so a declaration of ?MaxIndex? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp: In member function ?Vector<V, I, S> Vector<V, I, S>::operator/(const V&) const?:
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:190: error: there are no arguments to ?Size? that depend on a template parameter, so
a declaration of ?Size? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:190: error: there are no arguments to ?MinIndex? that depend on a template parameter
, so a declaration of ?MinIndex? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:193: error: there are no arguments to ?MinIndex? that depend on a template parameter
, so a declaration of ?MinIndex? must be available
/usr/data/CPP/CPP4FE/Utilities/VectorsAndMatrices/Vector.cpp:193: error: there are no arguments to ?MaxIndex? that depend on a template parameter
, so a declaration of ?MaxIndex? must be available
Cuchulainn wrote:Well, strange,fdmdirector.cpp is on the official CD... Did you look in chapter 10 directory?
The error message means that the namespace is defined twice. Maybe it was my addition to the test program, so just remove it once. It means the same code is being inserted twice (chapter 2)
BTW, as a check how many files in total do you have on the CD?