GCC 4.8 is really old (and 4.4 is completely obsolete) since from 2013 and not really supported anymore. You should upgrade your GCC compiler, at least to GCC 6, and if possible to GCC 7 (and in spring 2018, that would be GCC 8).
(with efforts, you could compile and install GCC 7 from its source code; and you don't always need root access for that)
You need to define for what C++ standard you want to code. I strongly recommend coding in C++11 at least, and if possible C++14. In a few months (e.g. mid 2018), C++17 could be convenient. C++11 is really different of its predecessors (so it is not even worthwhile to code for an older standard, unless you are forced to).
If you code for C++11, you want to use at least std::size_t (instead of the old C-specific size_t
) from <cstddef>
or <cstdlib>
etc... - and that standard header should be included before (or inside) yours, e.g. "somewhere/socket_client.h"
; with a recent g++
, you should compile with g++ -std=c++11 -Wall -Wextra -g
(to get C++11, all warnings, and debug info). Of course, if you want C++14, use -std=c++14
....
C++ is a very difficult programming language; if you are (like most of us, me included) still learning it, be sure to learn at least C++11 (or C++14) with some good C++ programming book.
Look also into some good C++ reference website (and even the appropriate C++ standard document).
BTW, you could find many libraries usable from C++ related to networking. Consider perhaps libcurl (client side) and libonion (server side) if you want to develop or use some Web API with HTTP, or POCO, or Qt, or Boost, or 0mq for general messaging (and there are many other libraries).
Most versions of GCC (even very old ones) support the -H
and -M
preprocessor options. You could use them (at least to understand what system headers get included).