Dev C++ compile problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SamuelXiao

    Dev C++ compile problem

    Here is the error, and the program run no problem in VC++;
    Compiler: Default compiler
    Building Makefile: "H:\CS2332\Summ er\STL001\Makef ile.win"
    Executing make...
    make.exe -f "H:\CS2332\Summ er\STL001\Makef ile.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>::conta ins(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,s td::allocator<_ CharT::const_it erator' is parsed as a
    non-type, but instantiation yields a type

    R03_stack.cpp.h :131: note: say `typename
    std::vector<T,s td::allocator<_ CharT::const_it erator' if a type is
    meant
    R03_stack.cpp.h : In member function `bool Stack<T>::conta ins(const T&)
    const [with T = int]':
    R03_stackDriver .cpp:83: instantiated from here
    R03_stack.cpp.h :116: error: dependent-name `
    std::vector<T,s td::allocator<_ CharT::const_it erator' is parsed as a
    non-type, but instantiation yields a type
    R03_stack.cpp.h :116: note: say `typename
    std::vector<T,s td::allocator<_ CharT::const_it erator' 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!
  • alasham.said@gmail.com

    #2
    Re: Dev C++ compile problem

    On Jul 2, 11:06 am, SamuelXiao <foolsmart2...@ gmail.comwrote:
    Here is the error, and the program run no problem in VC++;
    Compiler: Default compiler
    Building Makefile: "H:\CS2332\Summ er\STL001\Makef ile.win"
    Executing make...
    make.exe -f "H:\CS2332\Summ er\STL001\Makef ile.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>::conta ins(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,s td::allocator<_ CharT::const_it erator' is parsed as a
    non-type, but instantiation yields a type
    >
    R03_stack.cpp.h :131: note: say `typename
    std::vector<T,s td::allocator<_ CharT::const_it erator' if a type is
    meant
    R03_stack.cpp.h : In member function `bool Stack<T>::conta ins(const T&)
    const [with T = int]':
    R03_stackDriver .cpp:83: instantiated from here
    R03_stack.cpp.h :116: error: dependent-name `
    std::vector<T,s td::allocator<_ CharT::const_it erator' is parsed as a
    non-type, but instantiation yields a type
    R03_stack.cpp.h :116: note: say `typename
    std::vector<T,s td::allocator<_ CharT::const_it erator' 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.

    Comment

    • Lionel B

      #3
      Re: Dev C++ compile problem

      On Wed, 02 Jul 2008 02:06:32 -0700, SamuelXiao wrote:
      Here is the error,
      [...]

      Please read:



      Thanks,

      --
      Lionel B

      Comment

      Working...