I have the above error and have followed all solutions but does not fix.
This is my stdafx.h file. I have it in the target directory, I can see the file and the full path goes to there. In addition, I have created a win32 project. Why is my code not working?
// 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
ACTUAL CODE:
// 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; }
For the record, I had this problem when cloned a repo using git from the Ubuntu shell in Windows 10.
After I cloned the repo to a different location usin git from a Windows shell, the problem went away and the solution builds fine.
The issue was that the build scripts were looking for 'stdafx.cpp' in a folder with uppercase name (C:\GIT\LIBRARYX\SRC\
) and this path did not work if the solution was cloned using git from Ubuntu bash.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With