c++ - 错误 C1083 : Cannot open source file: "stdafx.cpp' : No such file or directory

标签 c++ visual-studio

我遇到上述错误并已遵循所有解决方案但没有解决。

这是我的 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; }

最佳答案

郑重声明,我在 Windows 10 的 Ubuntu shell 中使用 git 克隆存储库时遇到了这个问题。

在我从 Windows shell 使用 git 将存储库克隆到其他位置后,问题消失了,解决方案构建正常。

问题是构建脚本正在大写名称 (C:\GIT\LIBRARYX\SRC\) 的文件夹中寻找“stdafx.cpp”,如果解决方案是使用 git 从 Ubuntu bash 克隆的。

关于c++ - 错误 C1083 : Cannot open source file: "stdafx.cpp' : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41044510/

相关文章:

c++ - 使用 dOxygen 记录具有指定指针的 typedef 结构?

c# - 我不可见的下拉列表在 visual studio 中不再可见

c++ - 特征矩阵的就地元素类型转换

c++ - 编辑矩阵中的值就是删除它

c++ - Source Insight 3.5 显示 .c 文件的 "Parse Too complex"

c++ - 大多数守护程序应用程序如何在 Linux 中进行日志记录?

visual-studio - 为 Windows 8 编写的应用程序可以在 Windows Phone 8 上运行吗?

macos - Visual Studio Mac,从命令行构建?

c++ - “开始调试”在 Visual Studio 2005 中需要很长时间

c++ - 数据(错误)对齐的影响