我正在尝试在Visual Studio 2017中构建DLL(但它对于静态库的作用相同);这是我完整的source.cpp文件。
#include <iostream>
#include "stdafx.h"
void f() { std::cout << "I'm in f!\n"; }
我编译时抱怨
error C2039: 'cout': is not a member of 'std'
如果我删除stdafx.h,则投诉为
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
必须有一种编译使用std::
的函数的方法!