2

I am trying to compile a c++ file using cygwin. I get the following error :

fatal error: stddef.h: No such file or directory #include

This link provides a solution : link.

But even if I upgrade gcc and g++ package from the UI(setup.exe) it still gives me the same error.How to fix this? How to upgrade it from the cygwin command line?

Community
  • 1
  • 1
user1858851
  • 127
  • 1
  • 1
  • 12
  • It would be helpful if you would post your code (at least the beginning) and more of the output / error messages. – mnille Jan 13 '16 at 09:19
  • If you just care about getting gcc to work you could use the installer from [Qt Creator](http://www.qt.io/download). It will install gcc via mingw and set up everything so it just works. You don't have to install Qt or Qt Creator. – nwp Jan 13 '16 at 09:20
  • "I am trying to compile this code". Which code? Shows us the #include line. Also, show us your gcc command line and your environment. – Martin Bonner supports Monica Jan 13 '16 at 09:25
  • This is the code :#include using namespace std; char result[10][10] = {"zero","one","two","three","four","five","six","seven","eight","nine"}; int main() { int num; cin >> num; int temp = num; cout< 0) {temp = temp/10; numDigits = numDigits*10;} while (num >0) { numDigits /=10; cout << result[num/numDigits]<<" "; num = num%numDigits; } } – user1858851 Jan 13 '16 at 09:49
  • Have you tried Babun? http://stackoverflow.com/questions/31600600/compilation-error-stddef-h-no-such-file-or-directory – drkvogel Feb 20 '17 at 00:20

1 Answers1

0

The link you mentioned was the solution I'd used when I came across the same error. For the second part of the question, if you've worked with Ubuntu et al. you've heard of apt-get, and know how awesome it is. These guys made just that for Cygwin. :) Link to apt-cyg on GitHub.

After that, it's as simple as:

apt-cyg update <your packages>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
varevarao
  • 2,186
  • 13
  • 26
  • I updated the gcc-core and gcc-g++ packages,It still gives me the same error.gcc --version gives : gcc (GCC) 5.2.0 and g++ --version gives : g++ (GCC) 4.9.3. How do I know what packages to update?cygcheck -p g\+\+ does not search for g++ packages. – user1858851 Jan 13 '16 at 09:48
  • Since the DMCA takedown has been resolved again (see [this issue post](https://github.com/transcode-open/apt-cyg/issues/73#issuecomment-225156152) for background), I've rolled back the edit. – Martijn Pieters Apr 25 '17 at 17:06