home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!clark!frank
- From: frank@clark.edu (Frank Torres)
- Newsgroups: comp.lang.c++
- Subject: What's wrong with compiler's or program
- Message-ID: <1992Nov19.225912.11004@clark.edu>
- Date: 19 Nov 92 22:59:12 GMT
- Article-I.D.: clark.1992Nov19.225912.11004
- Distribution: usa
- Organization: Clark College, Vancouver, Wa. USA
- Lines: 128
-
-
- Please email me at:
- frank@clark.edu
- Can somebody explain why at LINK time I get an error for the static
- initialization for class printerQue. I have compiled this program with 3
- different compilers: gcc(2.2.2), occ(Oregon C++ Compiler), Borland C++(3.0).
- I also can't get this program to compile correctly with Borland C++.
- However, occ will compile this program without any complications.
- I would really like to get my program to compile with GCC. If
- you know what switches that need to be made at the prompt I would really
- appreciate it. Also, if there is anyone that can get this to work with
- Borland C++(3.0) or other I would like to know for kicks what I need
- to do to make it work under Borland C++. Again I would like for this
- program to work with >>>GCC(2.2.2)<<<. If I need the new version of
- GCC then I'll shall get it.
-
- Thank you for your time.
- P.S.
- Please email me at: frank@clark.edu
-
- -------------Error from output------------------
- Undefined first referenced
- symbol in file
- _10printerQue.waiting q2.o
- _10printerQue.first q2.o
- _10printerQue.ready q2.o
- .....continued for static declarations.....
- ------------end of output----------------
- >>>>>>>>>>>>> START of Program <<<<<<<<<<<<<<<<<
- #include <iostream.h>
- #include <stdio.h>
- #include <strings.h>
- #define MAXJOBS 2
-
- typedef enum Bool {true, false};
-
- class baseQue
- {
- private:
- Bool ok;
- protected:
- baseQue *cur, *prv, *nxt, *top;
- public:
- baseQue()
- {
- cur = this; // point to the previous instance
- cur->nxt = NULL; // point to the next NULL class.
- top = this; // point to the current instance of the class
- };
- // Below are pure virtual functions that will change from the derived
- // classes.
-
- virtual Bool addQue() = 0;
- virtual Bool inQue() = 0;
- virtual Bool outQue() = 0;
- };
-
- class printerQue : public baseQue
- {
- private:
- static Bool first; // used for beginning of linked list.
- static int numjobs, // number of jobs total in que.
- ready; // number of jobs that are ready to be processed.
- Bool ok, // use for checking
- waiting, // use for job waiting.
- exec; // use for job executing.
-
- char s[30]; // somekind of string of control character.
-
- public:
- printerQue()
- {
- first = true;
- ok = true;
- waiting = true;
- exec = true;
- numjobs = 0;
- ready = 0;
- }
-
- printerQue (char *trns)
- {
- strncpy (s,trns,30);
- cout << "in int :" << s;
- outQue();
- }
-
- Bool addQue ();
- Bool inQue ();
- Bool outQue();
- };
-
- Bool printerQue :: addQue()
- {
- while (waiting && numjobs > MAXJOBS)
- {
- cout << "waiting for 10 tries\n";
- ++numjobs; // count up the number of jobs in que.
- };
- return true;
- };
-
- Bool printerQue :: inQue()
- {
- if (first) top = this; // done only one time.
- prv = this; // set the current to the previous efore load the next.
- nxt = new printerQue; // create a new instance.
- if (nxt==NULL) return false; // unable to allocate memory.
- cur = this->nxt; // set the current to the next
- this->prv = prv; // this should tell the current to point to the previous
- return true;
- };
-
- Bool printerQue :: outQue()
- {
- if (cur != top) cur = top;
- cout << "\ns : " << *s;
- for (;this->cur == NULL; this->nxt)
- cout << "printing til end of que\n" << *s;
- return true;
- };
-
- int main()
- {
- printerQue start("test");
- }
-
- >>>>>>>>>>> END of Program <<<<<<<<<<<<<
-