How do I install gcc on cygwin?

Ok. You should launch the installer of cygwin setup-x86_64.exe (if you have deleted it from your computer than just download it from https://cygwin.com/install.html). In the Cygwin Setup dialog window just press Next, and press Next again. In dialog “Cygwin Setup – Choose Installation Directory” you should select root directory in wich CygWin has been installed & … Read more

Inheriting constructors

If your compiler supports C++11 standard, there is a constructor inheritance using using (pun intended). For more see Wikipedia C++11 article. You write: This is all or nothing – you cannot inherit only some constructors, if you write this, you inherit all of them. To inherit only selected ones you need to write the individual constructors manually and … Read more

Undefined reference to vtable

So, I’ve figured out the issue and it was a combination of bad logic and not being totally familiar with the automake/autotools world. I was adding the correct files to my Makefile.am template, but I wasn’t sure which step in our build process actually created the makefile itself. So, I was compiling with an old … Read more

How does #include work in C++?

It is basically a header file that also includes every standard library and STL include file. The only purpose I can see for it would be for testing and education. Se e.g. GCC 4.8.0 /bits/stdc++.h source. Using it would include a lot of unnecessary stuff and increases compilation time. Edit: As Neil says, it’s an implementation for … Read more

Convert char to int in C and C++

Depends on what you want to do: to read the value as an ascii code, you can write to convert the character ‘0’ -> 0, ‘1’ -> 1, etc, you can write Explanation:a – ‘0’ is equivalent to ((int)a) – ((int)’0′), which means the ascii values of the characters are subtracted from each other. Since 0 comes directly before 1 in the ascii … Read more