Fixed some G++ compiler errors and created a working CMakeLists.txt