Questions tagged [stdafx.h]

stdafx.h is a file, generated by Microsoft Visual Studio IDE wizards, that describes both standard system and project specific include files that are used frequently but hardly ever change.

Visual C++ will precompile this file to reduce overall compile times.

The AFX in stdafx.h stands for Application Framework eXtensions. AFX was the original abbreviation for the Microsoft Foundation Classes (MFC).

76 questions
0
votes
3 answers

C++ header file in Visual Studio

Okay. So I've got a simple question. If I ask it in the wrong place, please correct me. What I want to ask is, why Visual Studio gives me this: #include "stdafx.h" int main() { return 0; } everytime I create a new project? (I know I can…
minecraftplayer1234
  • 2,127
  • 4
  • 27
  • 57
0
votes
1 answer

afxwin.h issues in Visual Studio 2015 Windows Form App

A while ago i wrote a C++ CLI Windows Form app, which compiled fine in Visual Studio 2013. Now i wanted to recompile it in Visual Studio 2015 Update 1 but i'm facing a problem, and after hours of tests i figured out the culprit is afxwin.h. TL;DR -…
Fabius
  • 506
  • 9
  • 22
0
votes
1 answer

stdafx.h for all header files or only the pertinent

When using Microsoft's Optimised Compilation design -stdafx.h - is the idea that all includes should only ever occur in this file only. Or is it just compilation intensive components? If sticking to the all 'rule' will I achieve a faster more…
sazr
  • 24,984
  • 66
  • 194
  • 362
0
votes
2 answers

Is it OK to make a stdfx.h file myself?

Now, I realized that I need a precompiled header for my project. However, at the beginning, I created my project as an empty project which doesn't have a stdfx.h header file. So, this is what I did: - I created a header file name stdfx.h - In that…
Stoatman
  • 758
  • 3
  • 9
  • 22
0
votes
1 answer

Visual Studio Online, Pathing, C1083 and stdafx.cpp

So, I'm taking this class.... wince My day job is pretty technical, but I'm a complete Visual Studio newbie. I have a Visual Studio Express 2013 project that runs/compiles fine on my local system, but I have to get it to build in Visual Studio…
Dave P.
  • 41
  • 1
  • 3
0
votes
2 answers

Are variables and functions defined in a library project's Pre-compiled header available to applications using the library?

If a library project defines some variables and utility functions in its stdafx.h/cpp, will these be visible throughout application projects built on top of the library?
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
0
votes
1 answer

Reference a variable in a library that's declared in a dependent application

I can't remember what the rules are here, in my application project I currently declare a global variable in stdafx.h/cpp: extern const char *LOGFILE = "test.log" I've found that a library needs to know the value of this variable. Can I forward…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
0
votes
0 answers

Visual Studio 2013 fatal error c1083:cannot open include file "stadfx.h" no such file or directory

Hi guys I was trying to learn C++ during which my first program (the infamous hello world program) had problems i repeatedly get the C1083 fatal error include file "stdafx.h"not found no such file or directory. Any help would be appreciated thanks…
0
votes
1 answer

Header files included in stdafx.h are not found

i'm using visual studio 2008. I include some includes ( boost headers ) in the stdafx.h but, now they arent found by the compiler ( lexical_cast not found for example ). I included stdafx.h on the top of the cpp file. So what i'm doing…
user1235183
  • 3,002
  • 1
  • 27
  • 66
0
votes
1 answer

two projects using same .cpp file & header which has include "stdafx.h"

I have several functions in a .cpp file and I want several of my projects use the same file. So instead of copy them to different directories just add them (from original location) to project file in visual studio and use them. The problem is…
Roozbeh G
  • 427
  • 4
  • 18
-1
votes
1 answer

Does visual C++ check if it needs to re-generate its pch if I use /Yc

It seems that when I set the option to /Yu, it just uses whatever pch there is, without checking if it needs to be updated, meaning it would keep a list of headers it precompiles and check if those files has been updated since the last time they…
jokoon
  • 6,207
  • 11
  • 48
  • 85
-2
votes
2 answers

cannot open source file "stdafx.h" ConsoleApplication | identifier "_TCHAR" is undefine

im having trouble running my console app with the following format.I've looked through dozens of websites and stack overflow questions and non of them were useful.please help me figure this out: #include "stdafx.h" #include
Alin
  • 85
  • 1
  • 8
-2
votes
2 answers

Should stdafx.h/.cpp be removed from a static library project in C++?

While my static library is working fine, I noticed the default settings came with the following files: stdafx.h stdafx.cpp targetver.h I don't expect this library to be huge. I wish to minimalize as much as possible. Is stdafx.h/.cpp…
Bob
  • 327
  • 3
  • 12
-2
votes
2 answers

Why isn't include stdafx.h not enough for VisualStudio?

I understand that the purpose of precompiled header is about to speed up compilation process by using object file that was already compiled once and link it to actual project. But what I do not uderstand Is why should I explicitly enforce Visual…
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
-2
votes
1 answer

fatal error #1035: Can't find include file "stdafx.h"

I've started using Pelles C compiler as Microsoft Visual Studio won't work on my laptop. So, whenever I debug the following program, I get the "fatal error #1035: Can't find include file "stdafx.h". What's wrong here and what should I do to fix it?…