×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    6

    struct definition not ANSI-c, how to convert?

    Hi

    I am trying porting ncrypt open source application to open-c.
    At the moment there is problem with struct definition (below), which probably is not accoring to ansi-c standard.

    Q: How to convert the definition below to ansi-c?
    From line starting "static ..." comes error: "illegal use of incomplete struct/union/class 'struct option'"
    ..and from next line: "too many initializers"

    Any ideas?

    Code:
    int main(int argc, char** argv)
    {
        /* .... */
        static struct option long_options[] = {
          { "help",       0, NULL, 'h' },
          { "version",    0, NULL, 'V' },
          { "input",      1, NULL, 'i' },
          { "output",     1, NULL, 'o' },
          { "key",        1, NULL, 'k' },
          { "password-file",      1, NULL, 'f' },
          { "wipe-gutmann",       0, NULL, 'g' },
          { "verbose",    0, NULL, 'v' },
          { "encrypt",    0, NULL, 'e' },
          { "decrypt",    0, NULL, 'd' },
          { "wipe-military",      0, NULL, 'm' },
          { "aes",        0, NULL, 'a' },
          { "rijndael",   0, NULL, 'r' },
          { "serpent",    0, NULL, 's' },
          { "twofish",    0, NULL, 't' },
          { "encrypt-wipe",       0, NULL, 'z' },
          { NULL, 0, NULL, 0 }
        };
    /* ....*/
    }

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: struct definition not ANSI-c, how to convert?

    The message says the compiler does not know about struct option. Have you #included getopt.h?

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    6

    Red face Re: struct definition not ANSI-c, how to convert?

    Thanks, it was as simple as adding the mentioned header..

Similar Threads

  1. Error loading connection when obfuscation high?
    By ejakkk in forum Mobile Java General
    Replies: 8
    Last Post: 2009-06-26, 12:54
  2. Carbide.c++_vs3.0.1 and VS 2005 Problem
    By dhamu_b in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2008-08-18, 12:08
  3. linking error
    By dakosurf in forum Open C/C++
    Replies: 0
    Last Post: 2008-03-27, 09:20
  4. need information about j2me polish
    By rathikathangaraj in forum Mobile Java General
    Replies: 4
    Last Post: 2007-12-19, 09:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×