gdb “During startup program exited with code 126.”-Collection of common programming errors

A .o file is not a program, it is an object file that needs to be linked with libraries to produce a program. You can use gdb to inspect code within it, but it is not runnable (the “cannot execute binary file” message). You will need to link it to make a program. Possibly something like

g++ -o simplesearch simplesearch.o

will suffice, but without more information it’s not clear if it needs more libraries than just the system C libraries and C++ runtime support, etc.