gcc: stdio.h: No such file or directory

2 posts / 0 new
Last post
#1 Mon, 2014-10-20 18:23
mmonty
  • mmonty's picture
  • Offline
  • Last seen: 3 years 5 months ago
  • Joined: 2014-10-20

UPDATE: Well... adding g++ helped :P. For any developers reading this, consider including the libraries when someone adds gcc. I had *no idea* that I needed to add g++ as well. Oh well.

Hi! Installation went pretty smoothly. Just a tiny hiccup with gcc I guess. After "apk add gcc" I decided to compile a little hello world program and, well, like it says on the tin. I thought the standard libraries and dependencies would be added along with gcc. I'm not sure what else to add, I mean musl is already installed. What am I missing? Sorry if I am a bit of a noob-head.

#include <stdio.h>
#include <stdlib.h>
 
int main()
{
        printf("Hello.");
        exit(0);
}

Tue, 2014-10-21 08:27
AmatCoder
  • AmatCoder's picture
  • Offline
  • Last seen: 1 year 4 months ago
  • Joined: 2013-10-18

You need "apk add musl-dev" for these libraries.

Adding g++ worked because it has "libc-dev" as dependency which has "musl-dev".
But you are right: gcc also should have "libc-dev" as dependency.

Next time you can add "build-base" (this package includes "gcc", "g++", "libc-dev" and "make")

Edit:
I reported the issue #3467

Log in or register to post comments