简体   繁体   中英

C++ Unresolved external symbol when using wofstream

I am compiling and linking this source code from a batch file and the libraries that I am importing right now are MSVCRT.LIB Kernel32.lib User32.lib
The code works until I include string iostream and fstream and create some wofstream objects. That's when the linker shows me a large list of unresolved symbols, among which:

std::_BADOFF
static class std::locale::id std::codecvt
std::_Xout_of_range
std::_Fiopen
std::basic_streambuf
std::char_traits
std::basic_ios
std::locale::id::operator unsigned _int64

so I wonder what libraries might I be missing. In the linker I specified the /nodefaultlib options so I can decide what libraries to use but right now I have this problem and can't find the libraries for these standard functions.

Short: MSVCPRT.LIB

These symbols are defined in C++ Runtime Library. Although you do link with MSVCRT.lib (note the absence of letter P), that's only C, not C++ runtime.

And here is MSDN page you may find useful http://msdn.microsoft.com/en-us/library/abx4dbyh.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM