Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


getopt is not in scope #170

cqql opened this Issue · 13 comments

8 participants


It seems that in recent versions getopt() has been moved in it's own file, which prevents compilation of the spec runner. This can be fixed with

#include <getopt.h>

I am on Arch Linux using Qt 4.8.3

specrunner.cpp: In function ‘int main(int, char**)’:
specrunner.cpp:37:39: error: ‘getopt’ was not declared in this scope
specrunner.cpp:43:20: error: ‘optarg’ was not declared in this scope
specrunner.cpp:48:7: error: ‘optind’ was not declared in this scope
specrunner.cpp:61:16: error: ‘optind’ was not declared in this scope

Same here, on Ubuntu 12.10.


Same for me. Not sure on what that depends, but I'm running Fedora 17 with gcc 4.7.2 20120921 and glibc-devel-2.15.


Could you please explain how did you make a workaround for this ? In which file did you add the #include <getopt.h> ?


You add it somewhere before line 37 in specrunner.cpp. You see this when you look at the error message that was posted above. Or even better, look at your own error message.


Same here on Ubutu 12.10 amd64. This fix worked for me.


Thank you so much, @sickill! That works for me! I've been banging my head against this problem a long time.


Thanks a lot @sickill , it's working fine now


What's the status on this?


@leifg tip solves this, could this be kindly closed :smile:


I know, but I don't see changing a cpp file as a solution.

If this will be the final solution, I can provide a Pull Request


@leifg I just pull requested this fix (PR #175). I do not know either if this should be the final solution, but the PR is here!

@ConradIrwin ConradIrwin referenced this issue from a commit in rapportive-oss/jasmine-headless-webkit
Conrad Irwin Import getopt explicitly [Fixes #170] 93c3142
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.