www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/11/14:27:19

Xref: news-dnh.mv.net comp.os.msdos.djgpp:1475
Path: news-dnh.mv.net!mv!news.sprintlink.net!newsfeed.internetmci.com!news.mathworks.com!newshost.marcam.com!usc!news.cerf.net!newsserver.sdsc.edu!nic-nac.CSU.net!charnel.ecst.csuchico.edu!csusac!csus.edu!news.ucdavis.edu!wheel!elric
From: elric AT wheel DOT dcn DOT davis DOT ca DOT us (Jeffrey Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Weird problem with structs...
Date: 10 Aug 1995 17:46:07 GMT
Organization: Davis Community Network - Davis, California, USA
Lines: 63
References: <40bhfo$8k8 AT ixnews2 DOT ix DOT netcom DOT com>
Nntp-Posting-Host: wheel.dcn.davis.ca.us
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

I suspect that node may be defined as a macro in one of the header 
files.  Try "#undef node" after the #includes.

Danny Yoo 
(dannyyoo AT ix DOT netcom DOT com) 
wrote: : 	I'm having some really strange problems compiling a linked list
: program.  Compiling this portion of it:

: #include "stdlib.h"
: #include "conio.h"
: #include "iostream.h"
: #include "string.h"
: #include "ctype.h"
: static int NODECOUNT=0;
: const int ACTIVE=1;
: const int INACTIVE=0;

: struct link {
: 	struct node *nodeptr;
: 	char status;
: 	struct link *next;
: };
: struct node {
: 	// Node information
: 	int id;
: 	char *name;
: 	struct link *ring;
: };

: // Prototypes
: link *initlink(link *target);
: link *addlink(link *ring);
: node *initnode(node *target);
: void connect(node *element, node *nodes);
: void hook(node *element1, node *element2);
: void shownode(node *source);
: node *setnode(node *target);
: node *findnode(node *target, int number);

: results into strange error messages:

: sphere11.cpp:26: parse error before `*'
: sphere11.cpp:26: `target' was not declared in this scope
: sphere11.cpp:26: warning: ANSI C++ forbids declaration `initlink' with
: no type or storage class
: sphere11.cpp:27: parse error before `*'
: sphere11.cpp:27: `ring' was not declared in this scope
: sphere11.cpp:27: warning: ANSI C++ forbids declaration `addlink' with
: no type or storage class

: ... etc.  I see nothing wrong with the code, which compiles fine under
: TC 3.0.  The problem seems to be related to the #include files,
: because when I stripped them off the structs caused no problems during
: compilation...  I need to use DJGPP because of the memory hogging
: "features" <grin> of a spherical linked list.  I'm using v1.2 maint 4
: of DJGPP.  Any help would be greatly appreciated, thanks!


--
============================================
Without my guitar, I am a poet without arms.
                        - Michael Bloomfield
============================================

- Raw text -


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