1

Hi I have a few versions of gcc and g++ on my Ubuntu 16.04 which i select with alternative config. When compiling a very simple source the compiler can't find the headers.(stddef.h: No such file or directory)

Upon investigation the gcc installations don't have a full directory, for example:

usr/lib/gcc/x86_64-linux-gnu/4.8 has an include directory with cc1.exe

whilst:

usr/lib/gcc/x86_64-linux-gnu/4.7 had no include directory and no cc1.exe (just a cc1plus.exe)

I have re-installed 4.7 but can't seem to get it to be a complete installation ,any help?

Thanks

Emma

emmasaunders123
  • 149
  • 1
  • 1
  • 4
  • 2
    Most Linux distributions have a separate package that includes all the development files. On Fedora, for example, you would install the libstdc++-devel package. – Sam Varshavchik Oct 25 '17 at 16:11
  • Thanks, so I could download something similar for Ubuntu? I'm concerned as I am compiling a simple c file and when making larger projects in Cmake, I get complaints that it can't find the cc1.exe, and it can't as its not present in the include directory of the compiler I am using – emmasaunders123 Oct 25 '17 at 16:24
  • Use the dpkg command to search for all packages whose names contain "gcc" or "libstdc". Read their description. Read the documentation for the dpkg command. Figure it out yourself. – Sam Varshavchik Oct 25 '17 at 16:31
  • what kind of advice is that - figure it out yourself, don't you think I tried. I can read the description of every version of gcc i have installed, where is that going to get me when I have a specific query – emmasaunders123 Oct 25 '17 at 16:34
  • 1
    The most useful skill a developer can have is to know where to find and how to understand technical documentation. For example had you read the documentation I referred you to, you would've known that it includes not only packages that are already installed, but all packages that ***can*** be installed, in addition. Then, it becomes trivial to review the list, and install the ones that tell you they're for C++. – Sam Varshavchik Oct 25 '17 at 16:39
  • well, firstly I am not a developer but trying my best, secondly i have installed libstdc++ no to avail – emmasaunders123 Oct 25 '17 at 16:43
  • I just verified on someone else's Ubuntu 16 laptop, using dpkg, that one needs to install the "g++" and the correct "libstdc++-dev" packages. And I didn't have to ask someone else on stackoverflow.com to do this for me. – Sam Varshavchik Oct 25 '17 at 16:50
  • I've already installed g++ and libstdc++6 still the same error p.s you are a better developer than me - this isn't a competition - i've been struggling for two days – emmasaunders123 Oct 25 '17 at 16:55
  • Learn to read carefully. `libstdc++6` is not the same as `libstdc++-devel` – stark Oct 25 '17 at 17:38
  • Those files are part of libc development package linux-libc-dev package. If it isn't there you'll need to install the package. The kernel headers are part of package linux-headers- package. Something like linux-headers-4.4.0-47. These contain only kernel headers. This post has some relevant information too - https://stackoverflow.com/questions/37158651/why-is-stddef-h-not-in-usr-include – gusaki Oct 26 '17 at 13:37

0 Answers0