I'm trying to build a DLL (but it works the same for static library) in Visual Studio 2017; this is my complete source.cpp file.
#include <iostream>
#include "stdafx.h"
void f() { std::cout << "I'm in f!\n"; }
When I compile, it complains that
error C2039: 'cout': is not a member of 'std'
If I take out stdafx.h, its complaint is
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
There's got to be a way to compile functions that use std::
!