gpt4 book ai didi

C++ vector 推回错误

转载 作者:搜寻专家 更新时间:2023-10-31 01:13:21 27 4
gpt4 key购买 nike

<分区>

我每次尝试使用 Visual C++ 2008 进行调试时都会遇到错误

#include <iostream>
#include <vector>
#include <string>
#include <fstream>

using namespace std;

void load(const char* filename) {
vector <string*> vec;
ifstream in(filename);
char buffer[256];
while(!in.eof()) {
in.getline(buffer, 256);
vec.push_back(new std::string(buffer));
}
}

int main(int argc, char* args[]) {
cin.get();
return 0;
}

得到这个错误

Compiling...
main.cpp
Linking...
main.obj : error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "public: __thiscall std::_Vector_const_iterator,class std::allocator > *,class std::allocator,class std::allocator > *> >::_Vector_const_iterator,class std::allocator > *,class std::allocator,class std::allocator > *> >(class std::basic_string,class std::allocator > * *,class std::_Container_base_secure const *)" (??0?$_Vector_const_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@PAPAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@PBV_Container_base_secure@1@@Z)
E:\blabla\Debug\test2.exe : fatal error LNK1120: 1 unresolved externals

我做错了什么?

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com