I am new in C++ language, and I am trying to follow an example I found online. I am copying-pasting the online code line by line and trying to build after adding each line (because I am sure that it would never compile if I copy-pasted the whole code :)
I am facing the below errors:
E0309 more than one instance of constructor "std::basic_string<_Elem, _Traits, _Alloc>::basic_string [with _Elem=char, _Traits=std::char_traits, _Alloc=std::allocator]" matches the argument list
C2668 'std::basic_string<char,std::char_traits,std::allocator>::basic_string': ambiguous call to overloaded function
My code is :
#include <iostream>
#include <limits>
#include <fstream>
#include <string>
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
int main()
{
using namespace std;
string filename(0, MAX_PATH); // <------- This is the line which throws the error
std::cout << "Hello World!\n";
std::cout << "Press ENTER to continue...";
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
}