On page 393 of the users guide (5.26) (“Writing a Graphical User Interface”) it says to compile with the command:
which won’t work with gcc 4.6+ since it requires the libraries to be placed (correctly) at the end after the object files are listed:
There might be other places corrections are needed (like in Makefiles)