无法在 Visual Studio 2019 中调试 C++ 代码("Source Not Available"/"Unable to start program: *.exe" 问题)
Can not debug C++ code in Visual Studio 2019 ("Source Not Available"/"Unable to start program: *.exe" issues)
我正在使用 Windows 7 Professional。
我正在尝试在 Visual Studio 2019 年的 C++ 项目中调试一个简单的 C 代码。这是代码:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("#########################################\n");
// n: day that the query stops
int n = 5;
printf("Day to stop receiving queries: %d\n", n);
// q is the number of queries received by day
// ql is the amount of queries left to the next day
// k is the max of queries replied by day
long long int q = 0, ql = 0, k = 250;
printf("Max queries to read per day: %lld\n", k);
// day is the current day
int day = 1;
while (1) {
printf("#########################################\n");
if (day > n) {
q = 0;
}
else {
printf("Enter the number of queries received today\n");
scanf("%lld", &q);
}
printf("Day: %d\nQueries received today: %lld\nTotal of queries to read today: %lld\n", day, q, (ql + q));
if ((q + ql) > k) {
ql = q + ql - k;
printf("q: %lld\n", q);
printf("ql: %lld\n", ql);
printf("k: %lld\n", k);
}
else {
ql = 0;
break;
}
printf("Left queries to the next day: %lld\n", ql);
day++;
}
printf("#########################################\n");
printf("#########################################\n");
printf("Day with free time: %d\n", day);
printf("#########################################\n");
printf("#########################################\n");
return 0;
}
- 如果我尝试使用 x64 选项进行调试,我会收到“源不可用”消息:
"Source Not Available" message
我在代码的开头放置了一个断点,并注意到它在“scanf("%lld", &q);”行抛出异常。下面是异常信息:“Exception throw at 0x0000000076E6756E (ntdll.dll) in ChefAndEasyQueries.exe: 0xC0000005: Access violation writing location 0x0000000000000000.”
- 如果我尝试使用 x86 选项进行调试,我会收到“无法启动程序 *.exe / 访问被拒绝”错误消息(葡萄牙语):
"Unable to start program" message
.exe 文件不在指定目录中。我不知道 Visual Studio 是否没有创建文件,或者我的电脑是否以某种方式删除了它。
我认为我的防病毒软件正在删除 *.exe 文件。我没有停止或卸载防病毒软件的权限,因此我无法解决此 PC 中的问题。
我正在使用 Windows 7 Professional。
我正在尝试在 Visual Studio 2019 年的 C++ 项目中调试一个简单的 C 代码。这是代码:
#include <stdio.h>
#include <stdlib.h>
int main(void) {
printf("#########################################\n");
// n: day that the query stops
int n = 5;
printf("Day to stop receiving queries: %d\n", n);
// q is the number of queries received by day
// ql is the amount of queries left to the next day
// k is the max of queries replied by day
long long int q = 0, ql = 0, k = 250;
printf("Max queries to read per day: %lld\n", k);
// day is the current day
int day = 1;
while (1) {
printf("#########################################\n");
if (day > n) {
q = 0;
}
else {
printf("Enter the number of queries received today\n");
scanf("%lld", &q);
}
printf("Day: %d\nQueries received today: %lld\nTotal of queries to read today: %lld\n", day, q, (ql + q));
if ((q + ql) > k) {
ql = q + ql - k;
printf("q: %lld\n", q);
printf("ql: %lld\n", ql);
printf("k: %lld\n", k);
}
else {
ql = 0;
break;
}
printf("Left queries to the next day: %lld\n", ql);
day++;
}
printf("#########################################\n");
printf("#########################################\n");
printf("Day with free time: %d\n", day);
printf("#########################################\n");
printf("#########################################\n");
return 0;
}
- 如果我尝试使用 x64 选项进行调试,我会收到“源不可用”消息:
"Source Not Available" message
我在代码的开头放置了一个断点,并注意到它在“scanf("%lld", &q);”行抛出异常。下面是异常信息:“Exception throw at 0x0000000076E6756E (ntdll.dll) in ChefAndEasyQueries.exe: 0xC0000005: Access violation writing location 0x0000000000000000.”
- 如果我尝试使用 x86 选项进行调试,我会收到“无法启动程序 *.exe / 访问被拒绝”错误消息(葡萄牙语):
"Unable to start program" message
.exe 文件不在指定目录中。我不知道 Visual Studio 是否没有创建文件,或者我的电脑是否以某种方式删除了它。
我认为我的防病毒软件正在删除 *.exe 文件。我没有停止或卸载防病毒软件的权限,因此我无法解决此 PC 中的问题。