调试时GDB坏了 - 没有控制台输出?

时间:2012-02-08 18:30:24

标签: c++ debugging gdb codeblocks

我刚刚尝试在升级到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等。

附录:我使用Code :: Blocks作为我的想法。

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

--------------清理:在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

如果有帮助?...

1 个答案:

答案 0 :(得分:0)

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