GDB断开,同时没有控制台输出
GDB broken whilst no console output?
升级到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设置为默认值,所以我没有调试符号。我仍然收到奇怪的错误消息,但至少我现在得到了控制台输出:)
相关文章:
- C++:将控制台输出存储在宏中更好吗
- 在Qt Creator中,如何在连接到正在运行的进程后查看控制台输出
- 控制台输出在 Qt5 中未正确显示
- 有人可以向我解释为什么控制台输出 0 吗?
- 使用 std::string_view 的子字符串控制台输出
- C++ 如何暂停控制台输出,以便用户可以在继续之前阅读信息
- 我如何阅读简单的控制台输出
- 是否可以在 RTL(从右到左)中制作控制台输出?
- 如何让控制台输出覆盖控制台而不是纯文本输出?
- 乱码控制台输出管道 stderr 到更多
- 将控制台输出写入.txt并在控制台上显示
- 当被一个输入分开时,有两个控制台输出同时显示
- VSCode C++调试捕获控制台输出
- 如何将控制台输出中的所有内容复制到文本文件?
- C++ 使用简单的代码同时写入文件和控制台输出
- 使控制台输出是否"verbose"的最快方法
- 将 ffmpeg 控制台输出重定向到C++中的字符串或文件
- C++ 控制台输出到 cmd 在重复十次后出错
- 从控制台输出读取 C++
- 如何将控制台输出的文本颜色更改为红色,但如果从Powershell或CMD运行,背景将保持相同的颜色