Cygwin g++ compilation fails - c++

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?

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>

Related

Unable to compile openFrameworks

While trying to set up OF on eclipse (linux mint 17), I keep getting the following error :
g++: error: unrecognized command line option ‘-std=c++14’
I cannot find a solution online. I have tried updating my g++, replacing my libs/frameworks/video files with the latest on github, but nothing seems to work.
Though this issue has been closed here, i am unable to solve mine.
Is there a way to change the make file so that it builds successfully?
g++ doesn't support -std=c++14 until 4.9
See (for example) https://askubuntu.com/questions/428198/getting-installing-gcc-g-4-9-on-ubuntu for how to install 4.9 on Ubuntu

How to use previous versions of g++

I am currently running a debian Jessy whose g++'s version is 4.9. For some reason I need to compile a code in g++-4.7 or previous version.
I got the files of gcc-4.7 and g++-4.7 from a debian wheezy of a friend who has g++-4.7.
I tried to make the apt-get install, it seemed to have worked for the gcc but not for the g++. I put the files in the /bin, but he doesn't seem to locate the g++-4.7 package.
When I try to compile my code I specify g++-4.7 but get the error :
g++: error trying to exec 'cc1plus': execvp: No such file or directory
Any idea how to figure this out?
My advise is to add the wheezy repositories to /etc/apt/sources.list and then install g++-4.7 using apt-get. Using this method you will also get bugfixes etc.
I guess, currently you're just having dependency Problems. These will be solved when you use apt-get.
It is very easy to install gcc from sources. Remember that you have also to use a binutils version which maps to the gcc version. Mostly it is possible to run older gcc versions on actual binutils, but I have also seen a problem during install.
I have installed a long list of gcc versions in /opt/
Simply copy an older gcc version somewhere in the file system can result in problems with using the correct library versions.
If you install different gcc versions and also the related libraries e.g.libstdc++ , don't forget to update your library data base ( ldconfig/LD_LIBRARY_PATH/...) Maybe http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html can help.

Compiler Not Found

I am getting this error when i tried to compile my program
-bash: g++: command not found
Also I have only been getting this error after I formatted my Mac Book Pro
This error came after I did this
g++ functions.cpp
Please help me.
Thank You
Here is a cleanest solution than installing XCode just for Gcc.
STEP 1 > install this:
[HomeBrew Web Site] (http://brew.sh/)
All the informations concerning the installation and the utility of such a program are on the site itself.
It's a package manager, but for Mac. It's like apt-get or yaourt, if you ever used Ubuntu or Arch Linux.
STEP 2 > Go to the Terminal application and type :
$> homebrew search gcc
Then choose from the version you want, and type again in Terminal:
$> homebrew install [choosen version]
Gcc is now installed.

Cygwin 64 G++ -fuse-linker-plugin Error

I am receiving the following error when I try to compile a very basic C++ program.
$ g++ -fuse-linker-plugin test.cpp
g++: fatal error: -fuse-linker-plugin, but cyglto_plugin.dll not found
compilation terminated.
Code
int main() {
return 0;
}
This is using G++ installed straight out of a fresh Cygwin installation.
If I search for the file there, it does exist and is located at:
/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/cyglto_plugin.dll
How do I make Cygwin 64 look at this correctly?
I guess you only checked the gcc-g++ package at installation. Note that the version is 4.8.1-3 BUT on the next page you can see a lot of dependencies being installed, for example libgcc with version 4.8.2.
That mix of 4.8.1 and 4.8.2 seems to be the problem.
In the installer, copy all dependencies into an editor, search for 4.8.2 to find the problematic packages, go back in the installer and click those packages until 4.8.1-3 will be installed.
Double check you're not installing the latest version of those packages.
More recently using apt-cyg, g++ 4.9.2 was installed but gcc-core 4.8.2 remained.
Resolved by:
apt-cyg remove gcc-g++
apt-cyg remove gcc-core
apt-cyg install gcc-g++
Two version of gcc was causing proble, check folder /usr/libexec/gcc/x86_64-pc-cygwin/ there would be two version of gcc.
To solve remove one.
The above answer worked for me, but I got caught by the installer automatically upgrading packages back to 4.8.2. So, I initially thought this didn't work; it actually did. You just need to be aware of that when using the installer to add packages later, it may try to upgrade back to 4.8.2 again and break things.
There is the option to turn off LTO with -fno-use-linker-plugin, but that doesn't do me any good becuase CPAN is what is launching g++. It might serve as a workaround.
(I know this isn't much of an answer, but I was unable to comment)

g++: error: libgomp.spec: No such file or directory

I use g++ (GCC) 4.7.2. on Windows 7, 64-bit version.
downloaded from http://nuwen.net/mingw.html
I tried to use the "-fopenmp" flag and got the error:
g++: error: libgomp.spec: No such file or directory
I can't find the file anywhere on my system. Do I need to re-install something? Can I just throw a file somewhere?
You could try installing TDM-GCC, which looks as though it includes OpenMP.
There's also Sezero's personal build.
I had a similar problem. I got it working installing one of the version at the following discussion.
Which version of MinGW should I use
I don't have access to my windows machine now so I don't know which version I used but I can check on Monday if you don't have it working by then.
It might have been this one.
http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/