delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/07/18:38:13

From: caramaith <caramaith AT myokay DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: I don't understand the compiler...(semi-newbie)
Date: Tue, 07 Mar 2000 23:27:35 +0100
Organization: T-Online
Lines: 68
Message-ID: <38C58257.17B9D688@myokay.net>
Mime-Version: 1.0
X-Trace: news01.btx.dtag.de 952468191 27495 320054133135-0001 000307 22:29:51
X-Complaints-To: abuse AT t-online DOT de
X-Sender: 320054133135-0001 AT t-dialin DOT net
X-Mailer: Mozilla 4.7 [de] (Win98; I)
X-Accept-Language: de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019