#include <iostream>
#include <map>
#include <iterator>
using namespace std;
int main() {
FILE *fPtr = fopen("english.txt", "r");
if (fPtr == NULL) {
cout << "Could not open the file." << endl;
system("pause");
return 0;
}
char word[100];
map <string, int> freq;
while (!feof(fPtr)) {
fscanf(fPtr, "%s", word);
freq[word]++;
}
multimap <int, string > freq_rev;
map<string, int>::iterator it;
for (it = freq.begin(); it != freq.end(); it++)
freq_rev.insert(make_pair(it->second, it->first));
multimap <int, string>::reverse_iterator myit;
int count;
for (myit = freq_rev.rbegin(), count = 0; count < 10; myit++, count++)
cout << (*myit).second << " " << (*myit).first << endl;
fclose(fPtr);
system("pause");
return 0;
}
我正在使用 Visual Studio 2017 for Data Structures 类(class)。上面的代码应该查看包含大量单词的 english.txt 文件,检测这些单词的频率,并打印前 10 个最常用的单词。
在出现代码错误之前,VS 17 给出了这个 error :
Could not find c:/Users/username/documents/visual studio 2017/Projects/projectname/projectname/Debug/projectname.obj'.projectname.exe was built with /DEBUG:FASTLINK which requires object files for debugging.
Subsequent failures will be logged to the Debug pane of the Output window.
我不是一个经验丰富的程序员,我用谷歌搜索但找不到有用的东西。这应该是什么,我该怎么办?
最佳答案
我正在使用 VS2017,最近遇到了这个问题。唉,我发现错误报告是错误的。在我的项目属性中,该值与报告的条件无关:
“链接器->调试->生成调试信息”是
“生成调试信息/DEBUG”,而不是/DEBUG:FASTLINK
如何解决这个问题?确保以下字段在项目属性中具有不同的值:
链接器->调试->生成程序数据库文件
v.s.
C/C++"->输出文件->程序数据库文件名
就我而言,它们是相同的,因此报告误解了情况。 更改其中之一,例如不同的文件扩展名或为文件名添加下划线等。
祝你好运!
关于c++ - 调试 :FASTLINK - What is this error?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47912896/