小编Bra*_*sen的帖子

C++如何将argv保存为vector作为字符串

我试图将argv保存为矢量作为字符串,但我不断收到错误: see reference to function template instantiation 'std::vector<_Ty>::vector<_TCHAR*[]>(_Iter,_Iter)' being compiled

我已经尝试将argv保存到矢量或字符串,但它不起作用

我正在使用Microsoft Visual Studio 2010.

这是我的代码:

#include "stdafx.h"
#include <string>
#include <vector>
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
{
    std::vector<std::string> allArgs(argv + 1, argv + argc);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ string vector argv visual-c++

4
推荐指数
1
解决办法
1827
查看次数

标签 统计

argv ×1

c++ ×1

string ×1

vector ×1

visual-c++ ×1