Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22155

Invalid argument error compiling stdio.h / iostream

$
0
0

I'm suddenly having trouble compiling anything that includes these header files because of some error from inside the headers. I have never had issues with this before, and I don't even know what the error means. Any help is appreciated!

I am on Windows 10.0.18362 using the Ubuntu app with WSL.

The code is just hello world programs shown below, but when compiled I get the following errors for gcc and g++:

// test.c
#include <stdio.h>

int main(int argc, const char *argv[]) {
    printf("Hello, world!\n");
  return 0;
}
// test.cpp
#include <iostream>

int main(int argc, const char *argv[]) {
  std::cout << "Hello, world!"<< '\n';
  return 0;
}
gcc test.c
In file included from test.c:1:0:
/usr/include/stdio.h:27:10: fatal error: /usr/include/x86_64-linux-gnu/bits/libc-header-start.h: Invalid argument
 #include <bits/libc-header-start.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
g++ test.cpp
In file included from /usr/include/features.h:424:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/os_defines.h:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/c++config.h:533,
                 from /usr/include/c++/7/iostream:38,
                 from test.cpp:1:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:427:10: fatal error: /usr/include/x86_64-linux-gnu/bits/wordsize.h: Invalid argument
 #include <bits/wordsize.h>
          ^~~~~~~~~~~~~~~~~
compilation terminated.

Viewing all articles
Browse latest Browse all 22155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>