C++ program compilation for some linked list based problems