delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/02/14/21:27:06

From: efti AT ihug DOT com DOT au
Message-Id: <200102150222.NAA25220@new-smtp2.ihug.com.au>
X-Authentication-Warning: new-smtp2.ihug.com.au: Host kumera.ihug.com.au [203.109.250.78] claimed to be aubmgr01.ernstyoung.com.au
To: djgpp AT delorie DOT com
Subject: Unable to declare FILE pointer
Date: Thu, 15 Feb 2001 02:22:53 GMT
X-Mailer: Endymion MailMan Standard Edition v3.0.24
Reply-To: djgpp AT delorie DOT com

### Please reply to efti AT ihug DOT com DOT au ###

Hi,

I am totally new to C, but still I think this isn't my fault. I have installed
DJGPP and gcc + gpp (amongst others) onto a Win2k machine and a Win95 machine.
When I try to compile this with "gcc -o wpp.exe wpp.c":

#include <stdio.h>

#define TRUE	1
#define FALSE	0
#define OPTION_SWITCH '-'
#define BEGIN_DIRECTIVE '~'

#define VERSION	"0.0.1"
#define DEBUG	TRUE


enum {SUCCESS, ERROR}; // set named constants for SUCCESS (0) AND ERROR (1)



// Stuff...

int openinput(char *filename) //open input file
{

  FILE *fptr; // This is line 33 that returns parse error before `*'
  int result = SUCCESS;
  
  if((fptr = fopen(filename, "r")) == NULL) {
     printf("Cannot open input file: %s\n",filename);
     result = ERROR;

// more stuff...

And I get this

wpp.c: In function `openinput':
wpp.c:33: parse error before `*'
wpp.c:36: `fptr' undeclared (first use in this function)
wpp.c:36: (Each undeclared identifier is reported only once
wpp.c:36: for each function it appears in.)
wpp.c:38: `result' undeclared (first use in this function)

My question is: WHY??? does not gcc recognise the FILE type definition for what
it is? Is there a problem with my stdio.h that came with djgpp or is this a gcc
problem or am I totally nuts or WHAT IS GOING ON???

As far as I (and my reference book and all the stuff I looked up on the web)
know, this is perfectly legal in C isn't it:

#include <stdio.h>

- Raw text -


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