I just want to use std::wstring in my code just for learning purposes, but when i run this code (below) using Visual Studio 2017, it showns me error (below the code).
code:
#include<string>
#include<iostream>
#include "pch.h"
int main() {
double f = 23.32;
std::wstring f_str = std::to_wstring(f);
std::wcout << f_str;
}
error:
Error C2039 'wstring': is not a member of 'std'
You are using a pre-compiled header "pch.h".
The header "pch.h" should be included before all other header files.
If the precompiled header file is "pch.h" and the compile option is /Yu, Visual Studio will not compile anything before the #include "pch.h" in the source file; it assumes all code in the source up to and including that line is already compiled.
So you just have to change the order of inclusion of the header files such that "pch.h" is the first header to be included.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With