[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: compile problem on older program

On 10/28/2017 09:50 AM, Roberto C. Sánchez wrote:
On Sat, Oct 28, 2017 at 09:29:16AM -0700, Fred wrote:

I need to compile an older program and have a compile error.  How can I
resolve this?  Unfortunately I am not a C programmer although I do assembler

Here is the output of make:

making all in ./src...
make[1]: Entering directory '/opt/pcb-1.6.3p/src'
gcc -m32 -g -O2 -fno-strict-aliasing         -Dlinux -D__i386__
-DRELEASE=\"1.6.3\" -DPCBLIBDIR=\"/home/cad/lib/pcb\"  -DBTNMOD=\"Mod1\"
-DFONTFILENAME=\"default_font\"  -DLIBRARYFILENAME=\"pcblib\"
-DGNUM4=\"/usr/bin/m4\"  -DHAS_ATEXIT  -DHAS_REGEX      -c -o dev_rs274x.o
dev_rs274x.c: In function ‘GBX_PrintPolygon’:
dev_rs274x.c:821:13: error: invalid storage class for function
   static int isRectangle(PolygonTypePtr Ptr);
<builtin>: recipe for target 'dev_rs274x.o' failed
make[1]: *** [dev_rs274x.o] Error 1
make[1]: Leaving directory '/opt/pcb-1.6.3p/src'
Makefile:1071: recipe for target 'all' failed
make: *** [all] Error 2

The error is pointing to a function declaration.
The source:

This source is for the function definition/implementation.  We don't
even know if this is in the same source file as the line that caused the
error (which may or may not be relevant).

/* ----------------------------------------------------------------------
  * Checks a four-point polygon to see if it's a rectangle.
  * Tick off pairs of X & Y coords; if we get four matches,
  * we have a rectangle.
static int isRectangle(PolygonTypePtr Ptr)
     Cardinal i, j;
     int matches = 0;

         if (Ptr->PointN != 4)

         for (i=0; i<4; i++)
            for (j = i+1; j<4; j++) {
           if (Ptr->Points[i].X == Ptr->Points[j].X)

           if (Ptr->Points[i].Y == Ptr->Points[j].Y)

         if (matches == 4)

It is difficult to say, but this might explain it:

You may need to remove the static keyword from the declaration.

If you could provide complete sources (or a link to them) then perhaps
someone could provide a more definitive answer.



The source is at https://www.pastebin.com/X4a4p9U2

There are many similar lines with static keyword which the compiler didn't complain about.

The stackoverflow.com link suggests there is an unmatched bracket but I wasn't able to find one.

Best regards,

Reply to: