Menu

GCC

2023-01-16
2023-01-19
  • Bruce Irving

    Bruce Irving - 2023-01-16

    Peppermintos 64 bit. I'm trying to build a program that will let me select
    a data file. I'm currently trying to read the file and put the information
    into a struct then display the data. I've set it up that every thing is in
    the local directory.

    This is my command:

    [code]gcc -Wall -g -o gnctest *.c -L./
    -lbrlib[/code]resulting
    with[code]bruce@darterpro:/home/data/bruce/bin/src/GNCSearch$
    gcc -Wall -g -o gnctest *.c -lbrlib
    In file included from gncmain.c:19:
    gnudat.h:27:8: error: variably modified datid at file scope
       27 | { char datid[DATLN];
          |        ^~~~~
    gnudat.h:28:7: error: variably modified pthnm at file scope
       28 |  char pthnm[PTHNM];
          |       ^~~~~
    gnudat.h:29:7: error: variably modified flnm at file scope
       29 |  char flnm[FLNM];
          |       ^~~~
    In file included from gnudat.c:9:
    gnudat.h:27:8: error: variably modified datid at file scope
       27 | { char datid[DATLN];
          |        ^~~~~
    gnudat.h:28:7: error: variably modified pthnm at file scope
       28 |  char pthnm[PTHNM];
          |       ^~~~~
    gnudat.h:29:7: error: variably modified flnm at file scope
       29 |  char flnm[FLNM];
          |       ^~~~
    gnudat.c:29:22: error: variably modified GNCDAT at file scope
       29 | static struct GncDat GNCDAT[DATID];
          |                      ^~~~~~[/code]This is the code at this
    error[code]// number of structures
    #define DATID brversno("5")
    // max length of dtaid
    #define DATLN brversno("9")
    // length of pthnm
    #define PTHNM brversno("81")
    // length of flnm
    #define FLNM brversno("9")
    
    typedef struct GncDat
    { char datid[DATLN];
    char pthnm[PTHNM];
    char flnm[FLNM];
    } GncDatTp;/code]I used to be able to define an item as n integer.  Now I
    have to define them as a routine to convert a string to an integer!
    And, I don't understand 'variably modified datid at file scope'.   This
    occurred even if I was only trying to define a structure, IE:[code]struct
    GncDat
    { char datid[DATLN];
    char pthnm[PTHNM];
    char flnm[FLNM];
    }[/code]
    

    Where do I go from here?
    Bruce

    Edit by admins to format script for human legibility

     

    Last edit: Anonymous 2023-01-16
  • Bruce Irving

    Bruce Irving - 2023-01-19

    I hve also tried[code]bruce@bruce-76:~/data/bruce/bin/src/GNCSearch$ gcc -std=standard -Wall -g -o gnctest .c -L./ -lbrlib
    gcc: error: unrecognized command-line option ‘-std=standard’[\code]and[code]bruce@bruce-76:~/data/bruce/bin/src/GNCSearch$ gcc -ansi -Wall -g -o gnctest
    .c -L./ -lbrlib
    brerrrprt.c:16:1: error: C++ style comments are not allowed in ISO C90
    16 | // Add main()
    | ^
    brerrrprt.c:16:1: note: (this will be reported only once per input file)
    In file included from brerrrprt.c:19:
    brio.h:7:1: error: C++ style comments are not allowed in ISO C90
    7 | // brsperror use strerror{ int errno ); include <string.h>
    | ^
    brio.h:7:1: note: (this will be reported only once per input file)
    brio.h:157:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
    157 | #endif // BRIO_H[/code]</string.h>

     

Log in to post a comment.