我正在學習使用sublime3文本編輯器編寫C程序,我有兩種不同的崇高版本 此版本在CMD控制檯上輸出它的執行;Sublime 3控制檯上交互式程序的輸出
> {
"cmd": ["gcc", "$file_name", "-o", "${file_base_name}.exe", "&&", "start", "cmd", "/k", "$file_base_name"],
"selector": "source.c",
"working_dir": "${file_path}",
"shell": true
}
而其它構建輸出崇高控制檯上其執行
> {
"cmd": ["gcc", "$file_name", "-o", "$file_base_name"],
"selector": "source.c",
"working_dir": "${file_path}",
"variants":
[
{
"name": "Run",
"cmd": ["gcc","${file}", "-o", "$file_base_name", "&&", "$file_path/$file_base_name"],
"shell":true
}
]
}
我更喜歡第二內建但是當你用它來運行非交互式程序如"Hello world"
程序它只能和它給了我
#include <stdio.h>
#include <float.h>
// variable declaration;
int main()
{
float a,b,sum;
printf("Enter value of a\n");
// for float u use "f" instead of d
scanf("%f", &a);
printf("Enter value of b\n");
scanf("%f",&b);
sum=a+b;
printf("The sum of %f and %f = %f\n",a,b,sum);
return 0;
}
錯誤信息:當我用它來這樣運行了一個簡單的互動程序錯誤消息
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: cannot open output file addition.exe: Permission denied collect2.exe: error: ld returned 1 exit status [Finished in 0.3s]
我想知道我是否可以在崇高的控制檯上執行交互式程序,或者我需要對我的崇高構建做些事情。