Mail Archives: djgpp/2000/03/07/18:38:13
first and furthermore big thx fly out to Jason, Eli, Damian and Robin
for helping me out understanding the compiling and linking process. I
could well read the hundreds of pages with command-line options, but
this newsgroup is there for giving quick help... thx again!!!
---- now to my new question...
I created an ADT called Video(.h) and took the Stack.h (Stack.cpp) from
Bruce Eckel's Thinking in C++ (VolOne,Chap.4) to include them in a
testerfile called videostack.cpp.
now I try to compile and link using:
gpp -g Stack.o Video.o videostack.cpp -o videostack
and the compiler flags an error saying
videostack.cpp:10: 'Stack' undeclared(first use this function)
videostack.cpp:10: parse error before ';'
videostack.cpp:11: 'videoStack' undeclared(first use this function)
.....which are errors occuring when trying to declare variables without
types, but I did include the "Stack.h" as well as stating when linking
the code. here's an output of the beginning of "videostack.cpp"
#include <iostream.h>
#include "Stack.h"
#include "Video.h"
int main()
{
Stack videoStack; | line 10
videoStack.initialize(); | line 11
...
...
}
and here's the "Stack.h" by Bruce Eckel:
//: C04:Stack.h
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
// Nested struct in linked list
#ifndef STACK_H
#define STACK_H
struct Stack {
struct Link {
void* data;
Link* next;
void initialize(void* dat, Link* nxt);
}* head;
void initialize();
void push(void* dat);
void* peek();
void* pop();
void cleanup();
};
#endif // STACK_H ///:~
Did I miss out on something???? please help me (again as soon and as
professional as possible) ... thanks in advance...
cara
- Raw text -