Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error C1083: Cannot open source file: "stdafx.cpp': No such file or directory

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; }
like image 617
ThisIsPavski Avatar asked Mar 11 '23 11:03

ThisIsPavski


1 Answers

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.

like image 129
tymtam Avatar answered Mar 29 '23 22:03

tymtam