PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > Dev C++ compile problem
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Dev C++ compile problem

Réponse
 
LinkBack Outils de la discussion
Vieux 02/07/2008, 10h06   #1
SamuelXiao
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Dev C++ compile problem

Here is the error, and the program run no problem in VC++;
Compiler: Default compiler
Building Makefile: "H:\CS2332\Summer\STL001\Makefile.win"
Executing make...
make.exe -f "H:\CS2332\Summer\STL001\Makefile.win" all
g++.exe -c R03_stackDriver.cpp -o R03_stackDriver.o -I"C:/Dev-Cpp/lib/
gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward"
-I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/
3.4.2" -I"C:/Dev-Cpp/include"

In file included from R03_stackDriver.cpp:2:
R03_stack.h:105: error: declaration of `class T'

R03_stack.h:19: error: shadows template parm `class T'
In file included from R03_stack.h:115,
from R03_stackDriver.cpp:2:
R03_stack.cpp.h: In member function `bool Stack<T>::contains(const T&)
const':
R03_stack.cpp.h:116: error: expected `;' before "p"
R03_stack.cpp.h:117: error: `p' undeclared (first use this function)
R03_stack.cpp.h:117: error: (Each undeclared identifier is reported
only once for each function it appears in.)
R03_stack.cpp.h: In member function `unsigned int
Stack<T>::count(const T&) const':

R03_stack.cpp.h:131: error: expected `;' before "p"
R03_stack.cpp.h:132: error: `p' undeclared (first use this function)
R03_stack.cpp.h: In member function `unsigned int
Stack<T>::count(const T&) const [with T = int]':
R03_stackDriver.cpp:75: instantiated from here
R03_stack.cpp.h:131: error: dependent-name `
std::vector<T,std::allocator<_CharT> >::const_iterator' is parsed as a
non-type, but instantiation yields a type

R03_stack.cpp.h:131: note: say `typename
std::vector<T,std::allocator<_CharT> >::const_iterator' if a type is
meant
R03_stack.cpp.h: In member function `bool Stack<T>::contains(const T&)
const [with T = int]':
R03_stackDriver.cpp:83: instantiated from here
R03_stack.cpp.h:116: error: dependent-name `
std::vector<T,std::allocator<_CharT> >::const_iterator' is parsed as a
non-type, but instantiation yields a type
R03_stack.cpp.h:116: note: say `typename
std::vector<T,std::allocator<_CharT> >::const_iterator' if a type is
meant

make.exe: *** [R03_stackDriver.o] Error 1

Execution terminated

Some of the code(the Dev C++ says there are errors),

/**
* @brief display the whole stack
*/
template <class T>
friend ostream& operator << (ostream& outStream, const Stack<T>&
out);

How can I fix the problems? Thanks!
  Réponse avec citation
Vieux 02/07/2008, 10h51   #2
alasham.said@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Dev C++ compile problem

On Jul 2, 11:06 am, SamuelXiao <foolsmart2...@gmail.com> wrote:
> Here is the error, and the program run no problem in VC++;
> Compiler: Default compiler
> Building Makefile: "H:\CS2332\Summer\STL001\Makefile.win"
> Executing make...
> make.exe -f "H:\CS2332\Summer\STL001\Makefile.win" all
> g++.exe -c R03_stackDriver.cpp -o R03_stackDriver.o -I"C:/Dev-Cpp/lib/
> gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward"
> -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/
> 3.4.2" -I"C:/Dev-Cpp/include"
>
> In file included from R03_stackDriver.cpp:2:
> R03_stack.h:105: error: declaration of `class T'
>
> R03_stack.h:19: error: shadows template parm `class T'
> In file included from R03_stack.h:115,
> from R03_stackDriver.cpp:2:
> R03_stack.cpp.h: In member function `bool Stack<T>::contains(const T&)
> const':
> R03_stack.cpp.h:116: error: expected `;' before "p"
> R03_stack.cpp.h:117: error: `p' undeclared (first use this function)
> R03_stack.cpp.h:117: error: (Each undeclared identifier is reported
> only once for each function it appears in.)
> R03_stack.cpp.h: In member function `unsigned int
> Stack<T>::count(const T&) const':
>
> R03_stack.cpp.h:131: error: expected `;' before "p"
> R03_stack.cpp.h:132: error: `p' undeclared (first use this function)
> R03_stack.cpp.h: In member function `unsigned int
> Stack<T>::count(const T&) const [with T = int]':
> R03_stackDriver.cpp:75: instantiated from here
> R03_stack.cpp.h:131: error: dependent-name `
> std::vector<T,std::allocator<_CharT> >::const_iterator' is parsed as a
> non-type, but instantiation yields a type
>
> R03_stack.cpp.h:131: note: say `typename
> std::vector<T,std::allocator<_CharT> >::const_iterator' if a type is
> meant
> R03_stack.cpp.h: In member function `bool Stack<T>::contains(const T&)
> const [with T = int]':
> R03_stackDriver.cpp:83: instantiated from here
> R03_stack.cpp.h:116: error: dependent-name `
> std::vector<T,std::allocator<_CharT> >::const_iterator' is parsed as a
> non-type, but instantiation yields a type
> R03_stack.cpp.h:116: note: say `typename
> std::vector<T,std::allocator<_CharT> >::const_iterator' if a type is
> meant
>
> make.exe: *** [R03_stackDriver.o] Error 1
>
> Execution terminated
>
> Some of the code(the Dev C++ says there are errors),
>
> /**
> * @brief display the whole stack
> */
> template <class T>
> friend ostream& operator << (ostream& outStream, const Stack<T>&
> out);
>
> How can I fix the problems? Thanks!


Hello,

I believe you should provide minimal code that reproduces the error.

Regards.
  Réponse avec citation
Vieux 02/07/2008, 13h02   #3
Lionel B
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Dev C++ compile problem

On Wed, 02 Jul 2008 02:06:32 -0700, SamuelXiao wrote:

> Here is the error,


[...]

Please read:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.8

Thanks,

--
Lionel B
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 06h10.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13083 seconds with 11 queries