2014-09-10 139 views
1

我正在通過一門普通的編程課程同時學習C語言。課程設置建議Windows用戶使用SciTE,所以我做了。可能因爲我有Windows 8,我必須編輯SciTE cpp.properties文件才能運行示例程序。這是屬性文件的make/go部分的樣子:從SciTE運行時控制檯程序無法正確執行

ccopts=-pedantic -Os 
cc=g++ $(FileNameExt) -o $(FileName).exe 
ccc=gcc $(FileNameExt) -o $(FileName).exe 

make.command=make 
command.compile.*.c=$(ccc) -std=c99 
command.build.*.c=$(make.command) 
command.build.*.h=$(make.command) 
command.clean.*.c=$(make.command) clean 
command.clean.*.h=$(make.command) clean 
command.go.*.c=$(FileName) 

我的問題是我無法讓這個程序在SciTE中執行。它在PowerShell/cmd中工作正常,但如果我嘗試在SciTE中執行它,我不會得到第一個打印輸出,並且提供輸入什麼也不做。即使我停止執行,它也永遠不會結束。我必須進入任務管理器並結束程序。我之前遇到過這個問題,但那是因爲我打錯了。我不知道我在這裏拼寫錯誤:

#include <stdio.h> 
#include <conio.h> 

int main(void) 
{ 
    int num1; 
    int num2; 
    printf("Enter 2 numbers\n"); 
    scanf("%d%d", &num1, &num2); 

    if(num1 == num2) { 
     printf("they are equal\n"); 
    } 

    if(num1 < num2) { 
     printf("%d is less than %d\n", num1, num2); 
     } 

    if(num1 > num2) { 
     printf("%d is greater than %d\n", num1, num2); 
     } 

    getch(); 
} 

回答

0

賽特的輸出窗口是不是正規的控制檯你所期望的 - 你不能在賽特的輸出窗口要求用戶輸入。

但是,你也許可以利用parameters並稍微改變你的腳本接受參數,而不是用戶輸入。

另一種選擇是使用其他則默認爲subsystem go命令:

command.compile.*.c=gcc $(FileNameExt) -o $(FileName).exe 
command.go.*.c="$(FileDir)\$(FileName).exe" 
command.go.subsystem.*.c=2 

你可以,如果你想嘗試它在你cpp.properties末粘貼此塊。甚至更多,如果你想的是在飛行和執行編譯一個Go命令,添加此行上面塊:

command.go.needs.*.c=gcc $(FileNameExt) -o $(FileName).exe 

附註:您可以隨時終止正在運行的賽特計劃與Ctrl+Break或「工具>停止執行「菜單命令。

相關問題