GDB断开,同时没有控制台输出

GDB broken whilst no console output?

本文关键字:控制台 输出 断开 GDB      更新时间:2023-10-16

升级到Ubuntu 11.10后,我刚刚尝试调试我的C++程序,但我运行的gdb版本(7.3)似乎已损坏,无法进行调试输出。

发生了什么:

我点击调试,控制台窗口弹出,消息出现在顶部:

warning: GDB: failed to set controlling terminal: Operation not permitted

我没有从std::cout调用中得到任何输出,甚至只是一个

std::cout << "hi" << std::endl;

有人能帮忙吗?我试着在谷歌上搜索这个主题,发现了很多类似的问题,但不是与这个特定症状有关的问题,以及如何解决它。我已经确保我有最新版本的GDB等

附录:我使用代码::块作为我的ide。

用完整的命令行输出重建我的项目给出:

--------------清理:在DungeonCrawlerCPP中调试---------------

Cleaned "DungeonCrawlerCPP - Debug"
-------------- Build: Debug in DungeonCrawlerCPP ---------------
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/main.cpp -o obj/Debug/main.o
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/ActionableObject.cpp -o obj/Debug/src/ActionableObject.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/ActionableObject.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp -o obj/Debug/src/AppSettings.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:1:9: warning: #pragma once in main file [enabled by default]
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp: In member function ‘void AppSettings::load(const char*)’:
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:98:23: warning: statement has no effect [-Wunused-value]
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/AppSettings.cpp:114:29: warning: statement has no effect [-Wunused-value]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Container.cpp -o obj/Debug/src/Container.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Container.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Entity.cpp -o obj/Debug/src/Entity.o
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Item.cpp -o obj/Debug/src/Item.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Item.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Monster.cpp -o obj/Debug/src/Monster.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Monster.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp -o obj/Debug/src/Player.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp: In member function ‘void Player::attackMonster(std::string)’:
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Player.cpp:36:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/Room.cpp -o obj/Debug/src/Room.o
/home/reedja/CPPProjects/DungeonCrawlerCPP/src/Room.cpp:1:9: warning: #pragma once in main file [enabled by default]
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinystr.cpp -o obj/Debug/src/tinystr.o
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxml.cpp -o obj/Debug/src/tinyxml.o
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxmlerror.cpp -o obj/Debug/src/tinyxmlerror.o
g++ -Wall -fexceptions  -g -fpermissive -std=gnu++0x    -Iinclude  -c /home/reedja/CPPProjects/DungeonCrawlerCPP/src/tinyxmlparser.cpp -o obj/Debug/src/tinyxmlparser.o
g++  -o bin/Debug/DungeonCrawlerCPP obj/Debug/main.o obj/Debug/src/ActionableObject.o obj/Debug/src/AppSettings.o obj/Debug/src/Container.o obj/Debug/src/Entity.o obj/Debug/src/Item.o obj/Debug/src/Monster.o obj/Debug/src/Player.o obj/Debug/src/Room.o obj/Debug/src/tinystr.o obj/Debug/src/tinyxml.o obj/Debug/src/tinyxmlerror.o obj/Debug/src/tinyxmlparser.o    
Output size is 674.11 KB
Process terminated with status 0 (0 minutes, 6 seconds)
0 errors, 9 warnings

如果这有帮助?。。。

我找到了答案-出于某种原因C::B没有将全局-g设置为默认值,所以我没有调试符号。我仍然收到奇怪的错误消息,但至少我现在得到了控制台输出:)