bugGNU Gengetopt - Bugs: bug #47087, struct option from generated ggo.c...


bug #47087: struct option from generated ggo.c conflict with getopt.h from mac os sdk

Submitted by:  João Santinha <jsantinha>
Submitted on:  Mon 08 Feb 2016 09:09:05 AM UTC  
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 08 Feb 2016 09:09:05 AM UTC, original submission:

I have a project in which I am using gengetopt. In this project, I have two different settings (research and end user). The first one, for research purposes to which I create an executable that can be executed via command line and the second one, in which I create a library with the same functionality that will be added to a mac os x application to be given to an end user.

When using the library, to access the args_info structure with the default values , I need to add/include the generated ggo.c and ggo.h files to my mac os application project. It happens that the definition of 'struct option’ in the generated ggo.c file is conflicting with the mac os x sdk since the sdk has the getopt.h, that also defines 'struct option’.

Bellow you can see the errors:
test_ggo.c:504:8: Redefinition of 'option'
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/getopt.h:54:8: Previous definition is here
test_ggo.c:789:40: Definition of 'struct option' must be imported from module 'Darwin.getopt' before it is required
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/getopt.h:54:8: Previous definition is here

Do you know any solution to this issue?
I am not sure if this would solve it but I notice that the ‘struct getopt_data’ (present in the mac os sdk getopt.h) was changed to ’struct custom_getopt_data’ in the generated ggo.c file. Would it also be possible to apply (without impact) the "custom_" prefix to the ‘struct option” so it doesn't conflict with the mac os x sdk?

João Santinha <jsantinha>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jsantinha (Submitted the item)
  • -email is unavailable- added by jsantinha

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-08 jsantinha Carbon-Copy- => Added jsantinha

    Back to the top

    Powered by Savane 3.4