2015-05-18 20 views
9

Konsol uygulaması yazmak için clion kullanıyorum. Eğer programı çalıştırırsam, cout çağrılarımın sonuçlarını görebilirim. Ama ben hata ayıklamak, benim exe adı ve Process finished with exit code 0 dışında Debug Console sekmesinin altında hiçbir çıkış oluşur. Konsol çıktısını clion'da hata ayıklama altında göstermek için ek bir adım var mı?Clion'daki hata ayıklama altında konsol çıktısını nasıl yakalarsınız?

Yoksa bu da clion spesifik değil ve gdb'yi zaten bilen insanlar hakkında genel bir şey mi?

cevap

-3

GDB, bir program çalıştırma işlemini yönetir.

GDB oturumun bir örnek: sizin için yararlı olabilir

% cat hello.c 
#include<stdio.h> 

main() { 
    int count; 

    for (count=0;count<10;count++) 
     printf("Hello from CETS!\n"); 
} 

% gcc -g hello.c 
% gdb ./a.out 
GDB is free software and you are welcome to distribute copies of it 
under certain conditions; type "show copying" to see the conditions. 
There is absolutely no warranty for GDB; type "show warranty" for details. 
GDB 4.13 (sparc-sun-solaris2.3), 
Copyright 1994 Free Software Foundation, Inc... 
(gdb) b main 
Breakpoint 1 at 0x10784: file hello.c, line 6. 
(gdb) r 
Starting program: /home1/b/bozo/./a.out 


Breakpoint 1, main() at hello.c:6 
6   for (count=0;count<10;count++) 
(gdb) s 
7    printf("Hello from CETS!\n"); 
(gdb) p count 
$1 = 0 
(gdb) disp count 
1: count = 0 
(gdb) set count=8 
(gdb) s 
Hello from CETS! 
6   for (count=0;count<10;count++) 
1: count = 8 
(gdb) 
7    printf("Hello from CETS!\n"); 
1: count = 9 
(gdb) c 
Continuing. 
Hello from CETS! 

Program exited with code 01. 
(gdb) q 
% 

İçerik:

http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_gdb.html

http://www.ifp.illinois.edu/~nakazato/tips/xgcc.html#GDB

http://www.seas.upenn.edu/cets/answers/gcc.html

+0

ben 'don korkuyorum Gerçekten bu sorunun nasıl yanıtlandığını gör. Clion kullanırken doğrudan gdb ile etkileşime girmezsiniz. Bu bir IDE. – jep

+0

@jep, pardon o zaman. Sadece yardım etmeye çalıştım (: – Alex29954

+0

Sorun değil, sadece bir şeyi kaçırmadığımdan ya da sorumun yeterince açık olmadığından emin olmak. – jep

İlgili konular