我遇到了上述错误,并已经尝试了所有解决方案,但均无法解决。
这是我的stdafx.h文件。它在目标目录中,我可以看到该文件,完整路径指向那里。此外,我创建了一个win32项目。为什么我的代码不能工作?
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
实际代码:
// ConsoleApplication1.cpp : Defines the entry point for the console application. //
#include "stdafx.h"
#include <iostream>
int main() { std::cout << "Hello world!" << std::endl; return 0; }
stdafx.cpp
。或者禁用预编译头文件。并从您的项目中删除stdafx.cpp
。 - drescherjm