template from MSVC++ to Linux gcc 3.3.4

  • Thread starter Thomas Casanova
  • Start date
T

Thomas Casanova

Hi,


I am compiling a MSVC++ project on linux gcc 3.3.4.
gcc is whimsical about templates. It does understand the declaration
of the template type PointerList. It scream the error : 'PointerList'
is used as a type, but is not defined as a type. from this sources
code:

class TableFormat
{
public:
TableFormat();
~TableFormat();
protected:
private:
};

whereas the PointerList is

#include <list>

template <class T>
class PointerList : public std::list<T*>
{
public :
/* some overloaded function */
}

finaly the gcc sentence output:
g++ -v -fabi-version=0 -fpermissive
-I/home/marcel/projets/produit/Development/CompilUnix/src/xerces-c-src1_5_2/src
-I/home/marcel/projets/produit/Development/CompilUnix/src/Glance/include
-I/usr/lib/j2se/1.3/include
-I../../xerces-c-src1_5_2/src/validators/DTD/
-I../../xerces-c-src1_5_2/src/validators/schema/ -c -o
.../model/TableUtilities.o ../model/TableUtilities.cpp
Lecture des spécification à partir de
/usr/lib/gcc-lib/i486-linux/3.3.4/specs
Configuré avec: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc
i486-linux
Modèle de thread: posix
version gcc 3.3.4 (Debian)
/usr/lib/gcc-lib/i486-linux/3.3.4/cc1plus -quiet -v
-I/home/marcel/projets/produit/Development/CompilUnix/src/xerces-c-src1_5_2/src
-I../../xerces-c-src1_5_2/src/validators/common/
-I../../xerces-c-src1_5_2/src/validators/datatype/
-I../../xerces-c-src1_5_2/src/validators/DTD/
-I../../xerces-c-src1_5_2/src/validators/schema/ -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=4 -D_GNU_SOURCE
.../model/TableUtilities.cpp -D__GNUG__=3 -quiet -dumpbase
TableUtilities.cpp -auxbase-strip ../model/TableUtilities.o -version
-fabi-version=0 -fpermissive -o /tmp/cczugQh5.s
GNU C++ version 3.3.4 (Debian) (i486-linux)
compiled by GNU C version 3.3.4 (Debian).
GGC heuristics: --param ggc-min-expand=64 --param
ggc-min-heapsize=64445
le répertoire « /usr/i486-linux/include » est ignoré car inexistant
le répertoire « ../../Glance/include » est ignoré car présent deux
fois
le répertoire « ../../xerces-c-src1_5_2/src/util/Transcoders/Iconv400
» est ignoré car présent deux fois
la recherche pour #include "..." débute ici :
la recherche pour #include <...> débute ici:
/home/marcel/projets/produit/Development/CompilUnix/src/xerces-c-src1_5_2/src
/home/marcel/projets/produit/Development/CompilUnix/src/Glance/include
/usr/lib/j2se/1.3/include
/usr/lib/j2se/1.3/include/linux
../../LibJPG/jpeg-6b
../../utilities
/usr/local/include
/usr/lib/gcc-lib/i486-linux/3.3.4/include
/usr/include
Fin de la liste de recherche.
Dans le fichier inclus à partir de ../model/TableUtilities.cpp:1:
.../model/TableUtilities.h:14:25: Pointerlist.h : Aucun fichier ou
répertoire de ce type
Dans le fichier inclus à partir de ../model/TableUtilities.h:15,
à partir de ../model/TableUtilities.cpp:1:
.../model/TextValue.h:19:1: attention : « NULL » redéfini
Dans le fichier inclus à partir de /usr/include/iconv.h:24,
à partir de
/usr/include/c++/3.3/i486-linux/bits/c++locale.h:43,
à partir de /usr/include/c++/3.3/iosfwd:46,
à partir de /usr/include/c++/3.3/bits/stl_algobase.h:70,
à partir de /usr/include/c++/3.3/memory:54,
à partir de /usr/include/c++/3.3/string:48,
à partir de ../model/TextValue.h:17,
à partir de ../model/TableUtilities.h:15,
à partir de ../model/TableUtilities.cpp:1:
/usr/lib/gcc-lib/i486-linux/3.3.4/include/stddef.h:399:1: attention :
ceci est la localisation d'une précédente définition
Dans le fichier inclus à partir de ../model/ClippedElement.h:15,
à partir de ../model/TableUtilities.h:16,
à partir de ../model/TableUtilities.cpp:1:
.../model/ContextElement.h:127:29: attention : pas de retour chariot à
la fin du fichier
Dans le fichier inclus à partir de ../model/TableUtilities.h:16,
à partir de ../model/TableUtilities.cpp:1:
.../model/ClippedElement.h:68:29: attention : pas de retour chariot à
la fin du fichier
.../model/TableUtilities.h:125: error: 'PointerList' is used as a type,
but is
not defined as a type.
.../model/TableUtilities.h:126: error: 'PointerList' is used as a type,
but is
not defined as a type.
.../model/TableUtilities.h:127: error: 'PointerList' is used as a type,
but is
not defined as a type.
Dans le fichier inclus à partir de ../model/TableUtilities.cpp:1:
.../model/TableUtilities.h:136:29: attention : pas de retour chariot à
la fin du fichier
make: *** [../model/TableUtilities.o] Erreur 1
 
S

Sharad Kala

Thomas Casanova said:
Hi,


I am compiling a MSVC++ project on linux gcc 3.3.4.
gcc is whimsical about templates. It does understand the declaration
of the template type PointerList. It scream the error : 'PointerList'
is used as a type, but is not defined as a type. from this sources
code:

class TableFormat
{
public:
TableFormat();
~TableFormat();
protected:
private:

};

whereas the PointerList is

#include <list>

template <class T>
class PointerList : public std::list<T*>
{
public :
/* some overloaded function */
}

I don't see any problem other than the fact that you need a semicolon after
the class definition (assuming other things are correct).
template <class T>
class PointerList : public std::list<T*>
{
public :
/* some overloaded function */
}; // Semicolon here

Sharad

PS - Be carefule when inheriting from STL containers.
 
C

Chris

Thomas said:
Hi,


I am compiling a MSVC++ project on linux gcc 3.3.4.
gcc is whimsical about templates. It does understand the declaration
of the template type PointerList. It scream the error : 'PointerList'
is used as a type, but is not defined as a type. from this sources
code:
<code snipped>

It looks to me like there are other errors before the one you mention.
You should always fix the first error that appears first, as this may be
causing a knock-on effect, and often later errors will change or
disappear once the first ones are fixed.

Chris
 
A

Andre Dajd

Sharad Kala said:
PS - Be carefule when inheriting from STL containers.

Just don't do it, except privately and if do than never cast up internally.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top