, Потому что я не знаю, как это исправить (

аюсь отладить простую программу C ++ "hello world" на Ubuntu 16.04, но GDB не может распознать формат исполняемого файла. Тем не менее, я могу успешно запустить исполняемый файл в командной строке. Вот код

#include <iostream>
using namespace std;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    return 0;
}

Я компилирую файл программы TestProject.cpp с помощью команды

g++ -g TestProject.cpp -o hello

Затем для отладки я даю команду

gdb ./hello

Я получаю следующее сообщение об ошибке

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/home/<home>/./hello": not in executable format: File format not recognized

Кажется, что-то повреждено с машиной Ubuntu. Потому что я могу отлаживать ту же программу на другой виртуальной машине Ubuntu 16.04.

Ответы на вопрос(2)

Ваш ответ на вопрос