Original Post
When I try to build the following code from a fresh Microsoft Visual Studio 2005 Express Edition project, I get the following linker error: Another person has confirmed the same error. Does anyone else get this when building the above code? If you can get this code to compile and link with VC++ 8, please post what project options you are using. Thanks in advance. [Edited by - Mr Awesome on January 8, 2007 10:46:55 PM]
// Code:
#include <iostream>
#include <fstream>
#include <string>
int main()
{
std::ifstream fin("foo");
std::string str(std::istreambuf_iterator<char>(fin), std::istreambuf_iterator<char>());
std::cout << str;
}
// Linker error:
unresolved external symbol "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl script(class std::istreambuf_iterator<char,struct std::char_traits<char> >,class std::istreambuf_iterator<char,struct std::char_traits<char> > (__cdecl*)(void))"