Problems BC++2.0 -> gcc 
Author Message
 Problems BC++2.0 -> gcc

I'm having a problem with something I'm doing in C.  I have a
program that works okay in Borland  C++ 2.0 but refuses to compile under GCC
running on RH Linux 5.1.  The code that is causing problems is the bit to do
with opening the file that the program works with  is:
      FILE *bfptr;          (line 30)
      if((bfptr = fopen("books.dat", "r")) == NULL) {          (line 35)

Errors being produced:
      cgiview.c:30: parse error before `*'
      cgiview.c:35: `bfptr' undeclared (first use this function)
      cgiview.c:35: (Each undeclared identifier is reported only once
      cgiview.c:35: for each function it appears in.)

This works fine under BC2 so why not under GCC.  Can  anyone shed any light
on this?

--
dave
======================================

sms: 07974 047910
web: http://www.*-*-*.com/
=====================================



Thu, 11 Oct 2001 03:00:00 GMT  
 Problems BC++2.0 -> gcc

Quote:

>I'm having a problem with something I'm doing in C.  I have a
>program that works okay in Borland  C++ 2.0 but refuses to compile under
GCC
>running on RH Linux 5.1.  The code that is causing problems is the bit to
do
>with opening the file that the program works with  is:
>      FILE *bfptr;          (line 30)
>      if((bfptr = fopen("books.dat", "r")) == NULL) {          (line 35)

>Errors being produced:
>      cgiview.c:30: parse error before `*'
>      cgiview.c:35: `bfptr' undeclared (first use this function)
>      cgiview.c:35: (Each undeclared identifier is reported only once
>      cgiview.c:35: for each function it appears in.)

>This works fine under BC2 so why not under GCC.  Can  anyone shed any light
>on this?

Make sure <stdio.h> is included correctly ("parse error before '*' ")?
This is just a guess of course, since I can only see two lines
of code.
Other suggestions are:
    1) cut your source down to the minimum required to reproduce the problem
    2) post this code

It would be much easier to help if we could see more than
two lines.

  -dave

--
------------------------------------------------------------------------
* Remember to remove the spam blocker when replying.
* Return address is: dstarr AT xnet DOT com
------------------------------------------------------------------------



Thu, 11 Oct 2001 03:00:00 GMT  
 Problems BC++2.0 -> gcc

Quote:

> I'm having a problem with something I'm doing in C.  I have a
> program that works okay in Borland  C++ 2.0 but refuses to compile under GCC
> running on RH Linux 5.1.  The code that is causing problems is the bit to do
> with opening the file that the program works with  is:
>       FILE *bfptr;          (line 30)
>       if((bfptr = fopen("books.dat", "r")) == NULL) {          (line 35)

> Errors being produced:
>       cgiview.c:30: parse error before `*'
>       cgiview.c:35: `bfptr' undeclared (first use this function)
>       cgiview.c:35: (Each undeclared identifier is reported only once
>       cgiview.c:35: for each function it appears in.)

> This works fine under BC2 so why not under GCC.  Can  anyone shed any light
> on this?

FILE *bfptr;
will work fine under gcc as long as you have #included <stdio.h>, where FILE is
defined.  If you have done this, check line 29 for an error, usually omitting
the ';'.

--




Thu, 11 Oct 2001 03:00:00 GMT  
 Problems BC++2.0 -> gcc

   I'm having a problem with something I'm doing in C.  I have a
   program that works okay in Borland  C++ 2.0 but refuses to compile under GCC
   running on RH Linux 5.1.  The code that is causing problems is the bit to do
   with opening the file that the program works with  is:
         FILE *bfptr;          (line 30)
         if((bfptr = fopen("books.dat", "r")) == NULL) {          (line 35)

   Errors being produced:
         cgiview.c:30: parse error before `*'
   [...]

Did you #include <stdio.h>?
--
"You call this a *C* question? What the hell are you smoking?" --Kaz

Please: do not email me copies of your posts to comp.lang.c
        do not ask me C questions via email; post them instead



Fri, 12 Oct 2001 03:00:00 GMT  
 Problems BC++2.0 -> gcc

Quote:

> I'm having a problem with something I'm doing in C.  I have a
> program that works okay in Borland  C++ 2.0 but refuses to compile under GCC
> running on RH Linux 5.1.  The code that is causing problems is the bit to do
> with opening the file that the program works with  is:
>       FILE *bfptr;          (line 30)
>       if((bfptr = fopen("books.dat", "r")) == NULL) {          (line 35)

> Errors being produced:
>       cgiview.c:30: parse error before `*'
>       cgiview.c:35: `bfptr' undeclared (first use this function)
>       cgiview.c:35: (Each undeclared identifier is reported only once
>       cgiview.c:35: for each function it appears in.)

Do you include #included <stdio.h> where FILE is defined
Quote:
> This works fine under BC2 so why not under GCC.  Can  anyone shed any light
> on this?

> --
> dave
> ======================================

> sms: 07974 047910
> web: http://www.leehome.force9.co.uk/dave/
> =====================================



Sat, 13 Oct 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. problems with reading blocks >64k under bc++3.1

2. gcc -> visual c porting problem

3. Problems with <math.h> in gcc

4. bc++ 5.0 <-> watcom 11.0

5. HELP with BC qsort and aray >64k

6. BC 3.1 arrays >64k.... CAN BE DONE

7. BC 3.0 <dos.h>,<io.h> problems

8. gcc -> M68HC11

9. gcc->vc

10. <stdarg.h>, GCC on VMS

11. <stdarg.h>, GNU GCC

12. Cross Compilation with gcc (DEC3100 --> 68k)

 

 
Powered by phpBB® Forum Software