Fatal Error Stdafx.h No Such File Or Directory
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the stdafx.h no such file or directory linux workings and policies of this site About Us Learn more about Stack stdafx.h no such file or directory mingw Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs rpc.h: no such file or directory Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join
Visual Studio Stdafx.h Not Found
them; it only takes a minute: Sign up Fatal error: 'stdafx.h' file not found up vote 2 down vote favorite I am new to programming C++ and am trying to learn myself through websites (learncpp.com) although I am already stuck on compiling my first program =( . They use Visual Studio to program their code and because I am using cannot open source file stdafx cpp no such file or directory a macbook, I just use vi and terminal (or should I use something else?) Here's the helloworld.cpp program I wrote based on the tutorial: #include "stdafx.h" #include "here I am" post here to differ human beings from SPAM bots. Home Help Search Login stdafx.h download Register Wiki Code::Blocks » User forums » Using Code::Blocks » "stdafx.h" error when building « previous next » Send this topic Print Pages: [1] Go Down Author Topic: "stdafx.h" error when building (Read 10908 times) Kblavkalash Single posting newcomer Posts: 5 "stdafx.h" error when building « on: March 09, 2014, 12:13:02 pm » Hello, http://stackoverflow.com/questions/22621928/fatal-error-stdafx-h-file-not-found I've got a code and a header. Now I am Windows xp in on VM from Ubuntu, and when I try to build my c++ code it says:fatal error: stdafx.h: No such file or directoryNow if I delete this line from source code then I get:fatal error: CodeAnalysis\SourceAnnotations.h: No such file or directoryI have that http://forums.codeblocks.org/index.php?topic=19034.0 stdafx.h file in my project directory, so maybe I need to somehow tell him where to look? Logged stahta01 Lives here! Posts: 5393 Re: "stdafx.h" error when building « Reply #1 on: March 09, 2014, 01:03:55 pm » Please read and follow info on this link http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3FPost the "Build Log".Post the full path to the headers reported missing.Post the path to the Code::Blocks project file (cbp).Tim S. Logged C Programmer working to learn more about C++ and Git.On Windows 7 64 bit and Windows 10 32 bit.On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.--When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org Kblavkalash Single posting newcomer Posts: 5 Re: "stdafx.h" error when building « Reply #2 on: March 09, 2014, 02:21:44 pm » Build Log:Code: [Select]mingw32-g++.exe -c "C:\Documents and Settings\Administrator\Desktop\test\src1.cpp" -o "C:\Documents and Settings\Administrator\Desktop\test\src1.o" tutorial I hit a snag. In the tutorial 0.6 it clearly states: Important note to Visual Studio users: Visual studio http://www.cplusplus.com/forum/beginner/39659/ programs should ALWAYS begin with the following line: #include "stdafx.h" When I do that on the Hello World program I get the following error: Code: 1Gcc Stdafx.h: No Such File Or Directory
Where Is Stdafx.h Located
C:\Documents and Settings\Administrator\Desktop\test\src1.cpp:1:20: fatal error: stdafx.h: No such file or directory
#include "stdafx.h"
^
compilation terminated.
Process terminate
2
3
4
5
6
7
8
9
10
11
1>Build started 3/29/2011 2:18:18 PM. 1>InitializeBuildStatus: 1> Touching "Debug\HelloWorld.unsuccessfulbuild". 1>ClCompile: 1> Helloworld.cpp 1>c:\users\jon\documents\visual studio 2010\projects\helloworld\helloworld\helloworld.cpp(2): fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory 1> 1>Build FAILED. 1> 1>Time Elapsed 00:00:00.25 no such ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== If I build or Run [Without Debugging], leaving out #include "stdafx.h" it works fine. I know since I got it working, It shouldn't matter, but its bugging me and I have a feeling it might trip me up later if I don't know. Thanks in advance! Scibat Mar 30, 2011 no such file at 5:55pm UTC Disch (13766) Important note to Visual Studio users: Visual studio programs should ALWAYS begin with the following line: That tutorial is wrong. You only need stdafx.h if you make a project that has some prebuilt settings. If you choose to make an empty project with VS, you don't need it. In your case, try removing it. Mar 30, 2011 at 6:32pm UTC scibat (2) I guess I'll figure out when I need it and when I don't later on as I learn. Thanks for the help! Mar 30, 2011 at 7:21pm UTC Disch (13766) You only need it when MSVS gives it to you. If you make a blank project that starts with no cpp files, you don't need it. Usually when you DO need it, VS will give you a cpp file that already has the #include "stdafx.h" line at the time. Topic archived. No new replies allowed. C++ Information Tutorials Reference Articles Forum Forum BeginnersWindows ProgrammingUNIX/Linux ProgrammingGeneral C++ ProgrammingLoungeJobs Home page | Privacy policy© cplusplus.com, 2000-2016 - All rights reserved - v3.1Spotted an error? contact us