Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOT SOLVED][compile error] (in multiple files)error: ‘Stack’ was not declared in this scope #7

Open
OccupyMars2025 opened this issue Jan 21, 2024 · 0 comments

Comments

@OccupyMars2025
Copy link
Owner

OccupyMars2025 commented Jan 21, 2024

the reported errors are as follows:

src/evaluate_expression$ make all
c++ -pedantic-errors  -Wextra -Werror  -I../Vector  -I../Stack  -I../ -c evaluate_expression.cpp -MMD -o build/objects/./evaluate_expression.o
In file included from ../BinTree/BinNode_travPreorder.h:13,
                 from ../BinTree/BinNode_implementation.h:21,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../BinTree/BinNode_travPreorder_I1.h: In function ‘void travPre_I1(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPreorder_I1.h:37:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   37 |    Stack<BinNodePosi<T>> stack;
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPreorder_I1.h:37:23: error: expected primary-expression before ‘>’ token
   37 |    Stack<BinNodePosi<T>> stack;
      |                       ^~
../BinTree/BinNode_travPreorder_I1.h:37:26: error: ‘stack’ was not declared in this scope
   37 |    Stack<BinNodePosi<T>> stack;
      |                          ^~~~~
../BinTree/BinNode_travPreorder_I1.h:1:1: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
  +++ |+#include <stack>
    1 | /******************************************************************************************
In file included from ../BinTree/BinNode_travPreorder.h:14,
                 from ../BinTree/BinNode_implementation.h:21,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../BinTree/BinNode_travPreorder_I2.h: At global scope:
../BinTree/BinNode_travPreorder_I2.h:13:65: error: ‘Stack’ has not been declared
   13 | static void visitAlongLeftBranch( BinNodePosi<T> x, VST& visit, Stack<BinNodePosi<T>>& S ) {
      |                                                                 ^~~~~
../BinTree/BinNode_travPreorder_I2.h:13:70: error: expected ‘,’ or ‘...’ before ‘<’ token
   13 | static void visitAlongLeftBranch( BinNodePosi<T> x, VST& visit, Stack<BinNodePosi<T>>& S ) {
      |                                                                      ^
../BinTree/BinNode_travPreorder_I2.h: In function ‘void visitAlongLeftBranch(BinNodePosi<T>, VST&, int)’:
../BinTree/BinNode_travPreorder_I2.h:17:10: error: ‘S’ was not declared in this scope
   17 |          S.push( x->rc ); //�Һ�����ջ�ݴ棨���Ż���ͨ���жϣ�����յ��Һ�����ջ��
      |          ^
../BinTree/BinNode_travPreorder_I2.h: In function ‘void travPre_I2(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPreorder_I2.h:31:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPreorder_I2.h:31:23: error: expected primary-expression before ‘>’ token
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travPreorder_I2.h:31:26: error: ‘S’ was not declared in this scope
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travInorder.h:13,
                 from ../BinTree/BinNode_implementation.h:22,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../BinTree/BinNode_travInorder_I1.h: At global scope:
../BinTree/BinNode_travInorder_I1.h:12:50: error: ‘Stack’ has not been declared
   12 | static void goAlongLeftBranch( BinNodePosi<T> x, Stack<BinNodePosi<T>>& S ) {
      |                                                  ^~~~~
../BinTree/BinNode_travInorder_I1.h:12:55: error: expected ‘,’ or ‘...’ before ‘<’ token
   12 | static void goAlongLeftBranch( BinNodePosi<T> x, Stack<BinNodePosi<T>>& S ) {
      |                                                       ^
../BinTree/BinNode_travInorder_I1.h: In function ‘void goAlongLeftBranch(BinNodePosi<T>, int)’:
../BinTree/BinNode_travInorder_I1.h:14:7: error: ‘S’ was not declared in this scope
   14 |       S.push( x );
      |       ^
../BinTree/BinNode_travInorder_I1.h: In function ‘void travIn_I1(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travInorder_I1.h:28:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travInorder_I1.h:28:23: error: expected primary-expression before ‘>’ token
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travInorder_I1.h:28:26: error: ‘S’ was not declared in this scope
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travInorder.h:14,
                 from ../BinTree/BinNode_implementation.h:22,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../BinTree/BinNode_travInorder_I2.h: In function ‘void travIn_I2(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travInorder_I2.h:18:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travInorder_I2.h:18:23: error: expected primary-expression before ‘>’ token
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travInorder_I2.h:18:26: error: ‘S’ was not declared in this scope
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travPostorder.h:13,
                 from ../BinTree/BinNode_implementation.h:23,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../BinTree/BinNode_travPostorder_I.h: At global scope:
../BinTree/BinNode_travPostorder_I.h:66:13: error: variable or field ‘goToDeepestLeafVisibleFromLeft’ declared void
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../BinTree/BinNode_travPostorder_I.h:66:44: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                            ^~~~~
      |                                            obstack
../BinTree/BinNode_travPostorder_I.h:66:63: error: expected primary-expression before ‘>’ token
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                                               ^~
../BinTree/BinNode_travPostorder_I.h:66:67: error: ‘stack’ was not declared in this scope
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                                                   ^~~~~
../BinTree/BinNode_travPostorder_I.h:1:1: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
  +++ |+#include <stack>
    1 | /******************************************************************************************
../BinTree/BinNode_travPostorder_I.h: In function ‘void travPost_I(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPostorder_I.h:90:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   90 |    Stack<BinNodePosi<T>> stack;
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPostorder_I.h:90:23: error: expected primary-expression before ‘>’ token
   90 |    Stack<BinNodePosi<T>> stack;
      |                       ^~
../BinTree/BinNode_travPostorder_I.h:90:26: error: ‘stack’ was not declared in this scope
   90 |    Stack<BinNodePosi<T>> stack;
      |                          ^~~~~
../BinTree/BinNode_travPostorder_I.h:90:26: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
../BinTree/BinNode_travPostorder_I.h:95:10: error: there are no arguments to ‘goToDeepestLeafVisibleFromLeft’ that depend on a template parameter, so a declaration of ‘goToDeepestLeafVisibleFromLeft’ must be available [-fpermissive]
   95 |          goToDeepestLeafVisibleFromLeft(stack);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../BinTree/BinNode_travPostorder_I.h:95:10: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../Graph/Graph.h: At global scope:
../Graph/Graph.h:31:27: error: ‘Stack’ has not been declared
   31 |    void BCC( Rank, Rank&, Stack<Rank>& ); //����ͨ�򣩻���DFS��˫��ͨ�����ֽ��㷨
      |                           ^~~~~
../Graph/Graph.h:31:32: error: expected ‘,’ or ‘...’ before ‘<’ token
   31 |    void BCC( Rank, Rank&, Stack<Rank>& ); //����ͨ�򣩻���DFS��˫��ͨ�����ֽ��㷨
      |                                ^
../Graph/Graph.h:32:29: error: ‘Stack’ has not been declared
   32 |    bool TSort( Rank, Rank&, Stack<Tv>* ); //����ͨ�򣩻���DFS�����������㷨
      |                             ^~~~~
../Graph/Graph.h:32:34: error: expected ‘,’ or ‘...’ before ‘<’ token
   32 |    bool TSort( Rank, Rank&, Stack<Tv>* ); //����ͨ�򣩻���DFS�����������㷨
      |                                  ^
../Graph/Graph.h:61:4: error: ‘Stack’ does not name a type; did you mean ‘obstack’?
   61 |    Stack<Tv>* tSort( Rank ); //����DFS�����������㷨
      |    ^~~~~
      |    obstack
In file included from ../Graph/Graph_implementation.h:23,
                 from ../Graph/Graph.h:67,
                 from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../Graph/Graph_tsort.h:12:1: error: ‘Stack’ does not name a type; did you mean ‘obstack’?
   12 | Stack<Tv>* Graph<Tv, Te>::tSort( Rank s ) { // assert: 0 <= s < n
      | ^~~~~
      | obstack
../Graph/Graph_tsort.h:27:49: error: ‘Stack’ has not been declared
   27 | bool Graph<Tv, Te>::TSort( Rank v, Rank& clock, Stack<Tv>* S ) { // v < n
      |                                                 ^~~~~
../Graph/Graph_tsort.h:27:54: error: expected ‘,’ or ‘...’ before ‘<’ token
   27 | bool Graph<Tv, Te>::TSort( Rank v, Rank& clock, Stack<Tv>* S ) { // v < n
      |                                                      ^
../Graph/Graph_tsort.h: In member function ‘bool Graph<Tv, Te>::TSort(Rank, Rank&, int)’:
../Graph/Graph_tsort.h:33:36: error: ‘S’ was not declared in this scope
   33 |             if ( !TSort( u, clock, S ) ) //�Ӷ���u��������������
      |                                    ^
../Graph/Graph_tsort.h:43:27: error: ‘S’ was not declared in this scope
   43 |    status( v ) = VISITED; S->push( vertex( v ) ); //���㱻���ΪVISITEDʱ���漴��ջ
      |                           ^
In file included from ../Graph/Graph_implementation.h:24,
                 from ../Graph/Graph.h:67,
                 from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from evaluate_expression.cpp:1:
../Graph/Graph_bcc.h: In member function ‘void Graph<Tv, Te>::bcc(Rank)’:
../Graph/Graph_bcc.h:14:41: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                         ^~~~~
      |                                         obstack
../Graph/Graph_bcc.h:14:51: error: expected primary-expression before ‘>’ token
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                                   ^
../Graph/Graph_bcc.h:14:53: error: ‘S’ was not declared in this scope
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                                     ^
../Graph/Graph_bcc.h: At global scope:
../Graph/Graph_bcc.h:26:47: error: ‘Stack’ has not been declared
   26 | void Graph<Tv, Te>::BCC( Rank v, Rank& clock, Stack<Rank>& S ) { // assert: 0 <= v < n
      |                                               ^~~~~
../Graph/Graph_bcc.h:26:52: error: expected ‘,’ or ‘...’ before ‘<’ token
   26 | void Graph<Tv, Te>::BCC( Rank v, Rank& clock, Stack<Rank>& S ) { // assert: 0 <= v < n
      |                                                    ^
../Graph/Graph_bcc.h: In member function ‘void Graph<Tv, Te>::BCC(Rank, Rank&, int)’:
../Graph/Graph_bcc.h:27:63: error: ‘S’ was not declared in this scope
   27 |    hca( v ) = dTime( v ) = ++clock; status( v ) = DISCOVERED; S.push( v ); // v�����ֲ���ջ
      |                                                               ^
../Graph/Graph_bcc.h:37:23: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   37 |                /*DSA*/Stack<int> temp;
      |                       ^~~~~
      |                       obstack
../Graph/Graph_bcc.h:37:29: error: expected primary-expression before ‘int’
   37 |                /*DSA*/Stack<int> temp;
      |                             ^~~
../Graph/Graph_bcc.h:39:19: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   39 |                   temp.push ( S.pop() );
      |                   ^~~~
      |                   tm
../Graph/Graph_bcc.h:41:31: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   41 |                } while ( u != temp.top() );
      |                               ^~~~
      |                               tm
make: [Makefile:26: build/objects/./evaluate_expression.o] Error 1 (ignored)
c++ -pedantic-errors  -Wextra -Werror  -I../Vector  -I../Stack  -I../ -c main.cpp -MMD -o build/objects/./main.o
In file included from ../BinTree/BinNode_travPreorder.h:13,
                 from ../BinTree/BinNode_implementation.h:21,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../BinTree/BinNode_travPreorder_I1.h: In function ‘void travPre_I1(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPreorder_I1.h:37:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   37 |    Stack<BinNodePosi<T>> stack;
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPreorder_I1.h:37:23: error: expected primary-expression before ‘>’ token
   37 |    Stack<BinNodePosi<T>> stack;
      |                       ^~
../BinTree/BinNode_travPreorder_I1.h:37:26: error: ‘stack’ was not declared in this scope
   37 |    Stack<BinNodePosi<T>> stack;
      |                          ^~~~~
../BinTree/BinNode_travPreorder_I1.h:1:1: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
  +++ |+#include <stack>
    1 | /******************************************************************************************
In file included from ../BinTree/BinNode_travPreorder.h:14,
                 from ../BinTree/BinNode_implementation.h:21,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../BinTree/BinNode_travPreorder_I2.h: At global scope:
../BinTree/BinNode_travPreorder_I2.h:13:65: error: ‘Stack’ has not been declared
   13 | static void visitAlongLeftBranch( BinNodePosi<T> x, VST& visit, Stack<BinNodePosi<T>>& S ) {
      |                                                                 ^~~~~
../BinTree/BinNode_travPreorder_I2.h:13:70: error: expected ‘,’ or ‘...’ before ‘<’ token
   13 | static void visitAlongLeftBranch( BinNodePosi<T> x, VST& visit, Stack<BinNodePosi<T>>& S ) {
      |                                                                      ^
../BinTree/BinNode_travPreorder_I2.h: In function ‘void visitAlongLeftBranch(BinNodePosi<T>, VST&, int)’:
../BinTree/BinNode_travPreorder_I2.h:17:10: error: ‘S’ was not declared in this scope
   17 |          S.push( x->rc ); //�Һ�����ջ�ݴ棨���Ż���ͨ���жϣ�����յ��Һ�����ջ��
      |          ^
../BinTree/BinNode_travPreorder_I2.h: In function ‘void travPre_I2(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPreorder_I2.h:31:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPreorder_I2.h:31:23: error: expected primary-expression before ‘>’ token
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travPreorder_I2.h:31:26: error: ‘S’ was not declared in this scope
   31 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travInorder.h:13,
                 from ../BinTree/BinNode_implementation.h:22,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../BinTree/BinNode_travInorder_I1.h: At global scope:
../BinTree/BinNode_travInorder_I1.h:12:50: error: ‘Stack’ has not been declared
   12 | static void goAlongLeftBranch( BinNodePosi<T> x, Stack<BinNodePosi<T>>& S ) {
      |                                                  ^~~~~
../BinTree/BinNode_travInorder_I1.h:12:55: error: expected ‘,’ or ‘...’ before ‘<’ token
   12 | static void goAlongLeftBranch( BinNodePosi<T> x, Stack<BinNodePosi<T>>& S ) {
      |                                                       ^
../BinTree/BinNode_travInorder_I1.h: In function ‘void goAlongLeftBranch(BinNodePosi<T>, int)’:
../BinTree/BinNode_travInorder_I1.h:14:7: error: ‘S’ was not declared in this scope
   14 |       S.push( x );
      |       ^
../BinTree/BinNode_travInorder_I1.h: In function ‘void travIn_I1(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travInorder_I1.h:28:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travInorder_I1.h:28:23: error: expected primary-expression before ‘>’ token
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travInorder_I1.h:28:26: error: ‘S’ was not declared in this scope
   28 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travInorder.h:14,
                 from ../BinTree/BinNode_implementation.h:22,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../BinTree/BinNode_travInorder_I2.h: In function ‘void travIn_I2(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travInorder_I2.h:18:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travInorder_I2.h:18:23: error: expected primary-expression before ‘>’ token
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |                       ^~
../BinTree/BinNode_travInorder_I2.h:18:26: error: ‘S’ was not declared in this scope
   18 |    Stack<BinNodePosi<T>> S; //����ջ
      |                          ^
In file included from ../BinTree/BinNode_travPostorder.h:13,
                 from ../BinTree/BinNode_implementation.h:23,
                 from ../BinTree/BinNode.h:58,
                 from ../BinTree/BinTree.h:11,
                 from ../UniPrint/print.h:18,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../BinTree/BinNode_travPostorder_I.h: At global scope:
../BinTree/BinNode_travPostorder_I.h:66:13: error: variable or field ‘goToDeepestLeafVisibleFromLeft’ declared void
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../BinTree/BinNode_travPostorder_I.h:66:44: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                            ^~~~~
      |                                            obstack
../BinTree/BinNode_travPostorder_I.h:66:63: error: expected primary-expression before ‘>’ token
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                                               ^~
../BinTree/BinNode_travPostorder_I.h:66:67: error: ‘stack’ was not declared in this scope
   66 | static void goToDeepestLeafVisibleFromLeft(Stack<BinNodePosi<T>> &stack){
      |                                                                   ^~~~~
../BinTree/BinNode_travPostorder_I.h:1:1: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
  +++ |+#include <stack>
    1 | /******************************************************************************************
../BinTree/BinNode_travPostorder_I.h: In function ‘void travPost_I(BinNodePosi<T>, VST&)’:
../BinTree/BinNode_travPostorder_I.h:90:4: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   90 |    Stack<BinNodePosi<T>> stack;
      |    ^~~~~
      |    obstack
../BinTree/BinNode_travPostorder_I.h:90:23: error: expected primary-expression before ‘>’ token
   90 |    Stack<BinNodePosi<T>> stack;
      |                       ^~
../BinTree/BinNode_travPostorder_I.h:90:26: error: ‘stack’ was not declared in this scope
   90 |    Stack<BinNodePosi<T>> stack;
      |                          ^~~~~
../BinTree/BinNode_travPostorder_I.h:90:26: note: ‘std::stack’ is defined in header ‘<stack>’; did you forget to ‘#include <stack>’?
../BinTree/BinNode_travPostorder_I.h:95:10: error: there are no arguments to ‘goToDeepestLeafVisibleFromLeft’ that depend on a template parameter, so a declaration of ‘goToDeepestLeafVisibleFromLeft’ must be available [-fpermissive]
   95 |          goToDeepestLeafVisibleFromLeft(stack);
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../BinTree/BinNode_travPostorder_I.h:95:10: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
In file included from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../Graph/Graph.h: At global scope:
../Graph/Graph.h:31:27: error: ‘Stack’ has not been declared
   31 |    void BCC( Rank, Rank&, Stack<Rank>& ); //����ͨ�򣩻���DFS��˫��ͨ�����ֽ��㷨
      |                           ^~~~~
../Graph/Graph.h:31:32: error: expected ‘,’ or ‘...’ before ‘<’ token
   31 |    void BCC( Rank, Rank&, Stack<Rank>& ); //����ͨ�򣩻���DFS��˫��ͨ�����ֽ��㷨
      |                                ^
../Graph/Graph.h:32:29: error: ‘Stack’ has not been declared
   32 |    bool TSort( Rank, Rank&, Stack<Tv>* ); //����ͨ�򣩻���DFS�����������㷨
      |                             ^~~~~
../Graph/Graph.h:32:34: error: expected ‘,’ or ‘...’ before ‘<’ token
   32 |    bool TSort( Rank, Rank&, Stack<Tv>* ); //����ͨ�򣩻���DFS�����������㷨
      |                                  ^
../Graph/Graph.h:61:4: error: ‘Stack’ does not name a type; did you mean ‘obstack’?
   61 |    Stack<Tv>* tSort( Rank ); //����DFS�����������㷨
      |    ^~~~~
      |    obstack
In file included from ../Graph/Graph_implementation.h:23,
                 from ../Graph/Graph.h:67,
                 from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../Graph/Graph_tsort.h:12:1: error: ‘Stack’ does not name a type; did you mean ‘obstack’?
   12 | Stack<Tv>* Graph<Tv, Te>::tSort( Rank s ) { // assert: 0 <= s < n
      | ^~~~~
      | obstack
../Graph/Graph_tsort.h:27:49: error: ‘Stack’ has not been declared
   27 | bool Graph<Tv, Te>::TSort( Rank v, Rank& clock, Stack<Tv>* S ) { // v < n
      |                                                 ^~~~~
../Graph/Graph_tsort.h:27:54: error: expected ‘,’ or ‘...’ before ‘<’ token
   27 | bool Graph<Tv, Te>::TSort( Rank v, Rank& clock, Stack<Tv>* S ) { // v < n
      |                                                      ^
../Graph/Graph_tsort.h: In member function ‘bool Graph<Tv, Te>::TSort(Rank, Rank&, int)’:
../Graph/Graph_tsort.h:33:36: error: ‘S’ was not declared in this scope
   33 |             if ( !TSort( u, clock, S ) ) //�Ӷ���u��������������
      |                                    ^
../Graph/Graph_tsort.h:43:27: error: ‘S’ was not declared in this scope
   43 |    status( v ) = VISITED; S->push( vertex( v ) ); //���㱻���ΪVISITEDʱ���漴��ջ
      |                           ^
In file included from ../Graph/Graph_implementation.h:24,
                 from ../Graph/Graph.h:67,
                 from ../UniPrint/print.h:32,
                 from ../_share/crc_list.h:12,
                 from ../_share/util.h:36,
                 from ../Vector/Vector_implementation.h:17,
                 from ../Vector/Vector.h:85,
                 from ../stack_vector/stack_vector.h:11,
                 from ../Stack/Stack.h:15,
                 from ../evaluate_expression/evaluate_expression.h:13,
                 from main.cpp:1:
../Graph/Graph_bcc.h: In member function ‘void Graph<Tv, Te>::bcc(Rank)’:
../Graph/Graph_bcc.h:14:41: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                         ^~~~~
      |                                         obstack
../Graph/Graph_bcc.h:14:51: error: expected primary-expression before ‘>’ token
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                                   ^
../Graph/Graph_bcc.h:14:53: error: ‘S’ was not declared in this scope
   14 |    reset(); Rank clock = 0; Rank v = s; Stack<Rank> S; //ջS���Լ�¼�ѷ��ʵĶ���
      |                                                     ^
../Graph/Graph_bcc.h: At global scope:
../Graph/Graph_bcc.h:26:47: error: ‘Stack’ has not been declared
   26 | void Graph<Tv, Te>::BCC( Rank v, Rank& clock, Stack<Rank>& S ) { // assert: 0 <= v < n
      |                                               ^~~~~
../Graph/Graph_bcc.h:26:52: error: expected ‘,’ or ‘...’ before ‘<’ token
   26 | void Graph<Tv, Te>::BCC( Rank v, Rank& clock, Stack<Rank>& S ) { // assert: 0 <= v < n
      |                                                    ^
../Graph/Graph_bcc.h: In member function ‘void Graph<Tv, Te>::BCC(Rank, Rank&, int)’:
../Graph/Graph_bcc.h:27:63: error: ‘S’ was not declared in this scope
   27 |    hca( v ) = dTime( v ) = ++clock; status( v ) = DISCOVERED; S.push( v ); // v�����ֲ���ջ
      |                                                               ^
../Graph/Graph_bcc.h:37:23: error: ‘Stack’ was not declared in this scope; did you mean ‘obstack’?
   37 |                /*DSA*/Stack<int> temp;
      |                       ^~~~~
      |                       obstack
../Graph/Graph_bcc.h:37:29: error: expected primary-expression before ‘int’
   37 |                /*DSA*/Stack<int> temp;
      |                             ^~~
../Graph/Graph_bcc.h:39:19: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   39 |                   temp.push ( S.pop() );
      |                   ^~~~
      |                   tm
../Graph/Graph_bcc.h:41:31: error: ‘temp’ was not declared in this scope; did you mean ‘tm’?
   41 |                } while ( u != temp.top() );
      |                               ^~~~
      |                               tm
make: [Makefile:26: build/objects/./main.o] Error 1 (ignored)
c++ -pedantic-errors  -Wextra -Werror  -o ./build/apps/program build/objects/./evaluate_expression.o build/objects/./main.o -L/usr/lib -lstdc++ -lm
/usr/bin/ld: cannot find build/objects/./evaluate_expression.o: No such file or directory
/usr/bin/ld: cannot find build/objects/./main.o: No such file or directory
collect2: error: ld returned 1 exit status
make: [Makefile:30: build/apps/program] Error 1 (ignored)

a temporary workaround:

in the file src/evaluate_expression/evaluate_expression.h, after I added the following line, those compile errors disappeared :

#include "UniPrint/print.h"

The project organization is not good, I may need to reorganize the whole project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant